EBoard 37: Searching and analysis (Section 1)

Warning! You are being recorded and transcribed, provided the technology is working correctly.

Approximate optimistic overview

  • Administrivia
  • Quick academic honesty commentary
  • Questions and answers
  • Lab

Administrative stuff

Introductory notes

  • Congrats to our stickered student.
  • Please plan to attend class next Wednesday for project presentations.
  • Please plan to attend class next Friday for wrapup activities.
  • Our graders expect to finish grading the second redo of MPs 4 and 5 and the first redo of MP6 by Sunday night.

Upcoming activities

Scholarly

Artistic

  • Any day it’s open. GCMoA. BAX
  • Friday, 2 May 2025, 7:00–9:00 p.m., Sebring-Lewis. Silent Films with Improvised Scores
  • Friday, 2 May 2025, 7:30–8:30 p.m., Flanagan. Dance Ensemble/ACTivate: A Rebours
  • Saturday, 3 May 2025, 2:00–3:00 p.m., Flanagan. Dance Ensemble/ACTivate: A Rebours
  • Saturday, 3 May 2025, 7:00–8:00 p.m., Wall. Infinite Coincidence Improv Show
  • Thursday, 8 May 2025, 7:30–10:00 p.m., Sebring-Lewis. Symphonic Band Concert

Multicultural

  • Friday, 2 May 2025, 4:00–5:00 p.m., HSSC N1170 (Global Living Room). Middle of Everywhere: Brazil
  • Friday, 2 May 2025, 5:00 p.m., HSSC N 1164. ISO Scrap Book
  • Sunday, 4 May 2025, 2:00–8:30 p.m., Cleveland Beach. (Estimates.) Holi

Peer

Musical, theatric, sporting, and academic events involving this section’s students are welcome.

  • Read articles by your fellow CSC-151 students and comment on them online. This is the last week of normal S&B articles!
  • Saturday, 3 May 2025, Noon, Baseball field. Baseball vs. Knox (senior day)
  • Saturday, 3 May 2025, 2:30 p.m., Baseball field. Baseball vs. Knox

Wellness

  • When and where they usually occur. Badminton Club, Brazilian Jiu-Jitsu, _HIIT Training, Nerf at Noyce, Yoga.
  • Thursday, 8 May 2025. 4:30–6:30 p.m., Off Campus. Forest Bathing.
    • Sign ups are required.
  • Tuesday, 13 May 2025, 5:00–6:00 p.m., HSSC Atrium. Therapy Dogs.
  • Tuesday, 13 May 2025, 7:15–8:15 p.m., HSSC Atrium. Therapy Dogs.

Misc

  • Friday, 2 May 2025, 3:30–5:00 p.m., Burling Digital Studio. Vivero End-of-Year Showcase
  • Friday, 2 May 2025, 5:00 p.m., Merrill Park West. CS Picnic
  • Sunday, 4 May 2025, 7:30–8:30 p.m., Science 3819. Mentor Session: SoLA 4
  • Wednesday, 7 May 2025, Noon–1:00 p.m., HSSC A2231 (Auditorium) Community Forum
    • “Weekly discussion on legal protections and recourse on issues that higher education and Grinnell College face.”
    • Also online.
    • Surviving the summer.

Other good things

These do not earn tokens, but are worth your consideration.

Upcoming work

  • Sunday, 4 May 2025
  • Monday, 5 May 2025
    • SoLA 4 released!
    • Topics from Phase One (4): Collaboration, Decomposition, Lambda-free anonymous procedures (aka cut and compose), Primitive types
    • Topics from Phase Two (6): Conditionals, Documentation, Ethical Considerations, Lists (and “the big three”), Program style, Testing
    • Topics from Phase Three (5): List recursion, Local bindings, Numeric recursion, Vectors, Randomness
    • Topics from Phase Four w/prior quizzes (3): Data abstraction, Dictionaries, Higher-order programming
    • Topics from Phase Four already covered (1): Tree recursion
    • Topics from Phase Four to be covered today (2): Running time, Searching
  • Wednesday, 7 May 2025
    • Project presentations.
  • Friday, 9 May 2025
  • Friday, 16 May 2025 (5pm)
    • Submit final redo for MP1 on Gradescope
    • Submit final redo for MP2 on Gradescope
    • Submit final redo for MP3 on Gradescope
    • Submit final redo for MP4 on Gradescope
    • Submit final redo for MP5 on Gradescope
    • Submit final redo for MP6 on Gradescope
    • Submit final redo for MP7 on Gradescope
    • Submit SoLA 5 on Gradescope

Friday PSA

  • You are awesome. Please remain so
  • Detour: Weekend Harris and Gardner
  • Moderation
  • Consent is essential, but not sufficient

Academic honesty

The Dean’s office has asked us to remind you about College academic honesty policies and about our course policies on the use of generative AI.

If you discover evidence that a student may have violated either the college academic honesty policy or the relevant academic honesty policy for your course/assignment, you must report that violation to the Committee on Academic Standing (CAS) for review.

Just in case it’s not clear already:

  • You may not use a generative AI tool to help you do your work in this class. In particular, you may not have a tool generate code for you for mini-projects or learning assessments.
  • You may not use a generative AI tool in any way for your SoLA responses.
  • In writing SoLA responses, you may rely only on yourself, your notes, my course Web site, the DrRacket reference, and DrRacket.
  • If you refer to my site or the DrRacket reference, you must cite your source (and cite it clearly).
  • If you feed course materials to a generative AI tool for other purposes (e.g., to get a summary or to generate problems), you must ensure that it does not use the course materials as training data. Otherwise, you are violating copyright.
  • Hire fellow students rather than using Dall-E.

Questions

Administrative

Can I reflect on S&B articles from past weeks?

Nope. Only the current week.

Is there a limit to the number of tokens I can earn in a week?

Yes. Five.

Project

Running time

Can we go over the self check?

Certainly. We’ll do it as a quick TPS exercise.

Constant: Independent of the “size” of the input.

Linear: As the size of the input goes up, the number of steps goes up correspondingly (e.g., if we double the input size, we approximately double the number of steps).

Quadratic

cdr - Constant time; we just cross off the first element (or follow the second box).

cddr -Constant time; Two steps to chop off the first two.

list-ref - Linear; we have to advance one step for each position

vector-ref - Constant; Sam told us so when we learned vectors. Our experiments show this.

map - Linear. We’ll have to make a list of as many elements as were in the first list.

range - Linear. For (range n), we have to make a list of n elements.

Have we encountered any examples of quadratic time algorithms yet?

Yes. Many of the list recursive algorithms that use length to determine if we have only one element end up being quadratic.

What exactly does ‘less-equal?’ check?

It depends on what kinds of values we’re storing and what order they’ve been stored. It hould correspond to the order they’ve been stored.

For numbers, it usually checks if one number is less than or equal to another number. For strings, it normally checks if one string comes before another alphabetically (as determined by string-ci<=?).

Can we go over the self check?

Certainly. TPS! (I’ve also added a question.)

a. Explain the role of the less-equal? in binary-search.

Sam did this. Lets us tell whether a value is less than or equal to (or greater than) another value.

b. In binary-search, how do we know if two values are equal?

If the middle key is less than the sought value and the sought value is less than the middle key, they must be equal.

Runner says “That’s like double containment from linear.”

Sam says “If a <= b and b <= a, then a and b are the same.”

c. Explain the role of midpoint, middle-element, middle-key, which are bound in the let* of binary-search.

The index

Element in the middle section

Middle key is the key of that element; the thing we use when searching.

d. Describe what lower-bound and upper-bound represent.

The left half and the right half of the section of the vector of interest. lower-bound is inclusive (that means the value we’re searching could be at index lower-bound). upper-bound is exclusive (that means the value we’re searching for cannot be at index upper-bound or that index upper-bound is outside the range of the vector).

e. Describe why and how the upper-bound of helper search-portion changes when the key we’re looking for is less than the middle key. (If it doesn’t change, explain why not.)

The upper bound becomes the middle index (midpoint).

If we decreased by one (- midpoint 1), we might miss an element because upper bound is exclusive.

f. Describe why and how the lower-bound of helper search-portion changes when the key we’re looking for is greater than the middle key. (If it doesn’t change, explain why not.)

The lower bound becomes (+ midpoint 1).

We use (+ midpoint 1) rather than midpoint because we know that it’s strictly after the middle (we’ve already compared to the middle)

g. If we double the length of the vector, what is the worst case effect on the number of recursive calls in binary-search?

About one extra recursive call. We split the range of interest in half each time. So we quickly go from double the size to the original size.

Lab

When you want to use the whole value as a key, use (lambda (x) x) as your get-key procedure.