class: title # Using Stacks and Queues ## CSC 161 – April 9, 2026 --- # Agenda for Today 1. Quiz 2. Department Events 3. Upcoming Work 4. Discussion 5. Lab 6. Wrap Up --- class: section green # Quiz --- # Department Events ## CS Poster Sessions: Wednesday and Thursday this week .indent[ Wednesday, April 8th and Thursday, April 9th from 4:15–5:45pm in HSSC A1231 Snacks (including fresh fruit) will be provided! ] ## Ali Akgun '93 Visit .indent[ Watch for announcements about events with Ali Akgun (CS alum and Microsoft VP) happening next week. ] --- class: section blue # Upcoming Work --- # Homework: Lightcycle **Due:** Thursday, April 9th ## Questions? --- class: section blue # Discussion --- # Search Algorithm 1 .left-col-40[ ```nohighlight stack_search(start, goal): s is an empty stack set_visited(start) push(s, start) while !empty(s): p = pop(s) if p == goal: Success! for dir in [↑, →, ↓, ←]: if valid_move(p, dir): n = move(p, dir) if !is_visited(n): set_visited(n) push(s, n) ``` ] -- .right-col-60[
] --- # Search Algorithm 2 .left-col-40[ ```nohighlight queue_search(start, goal): q is an empty queue set_visited(start) add(q, start) while !empty(q): p = take(q) if p == goal: Success! for dir in [↑, →, ↓, ←]: if valid_move(p, dir): n = move(p, dir) if !is_visited(n): set_visited(n) add(q, n) ``` ] .right-col-60[
] --- # Discussion: Search Algorithms **Items for think, pair, share:** 1. Can you think of a concise way to describe the behavior of the stack-based search algorithm? 2. Can you think of a concise way to describe the behavior of the queue-based search algorithm? 3. Think of a problem that one of these search algorithms could help you solve. Does it matter which algorithm you use? --- # Homework: Pathfinding **Due:** Thursday, April 23rd Let's look at the assignment and some demo programs. --- class: section green # Lab Time --- class: section blue # Wrap Up --- # Peer Educator Evaluations .left-col[ Fill out the form at
to evaluate mentors and other peer educators you've worked with this semester. ## Token Opportunity If every student in the class completes the mentor evaluation before Monday I will give you all one additional token. ] .right-col[
] --- # Wrap Up ## Week 10 Lab Report Submit your completed `string_stack.c`, `string_stack.h`, `string_queue.c`, and `string_queue.h` files. ## Lightcycle Assignment The assignment is due at 10pm tonight, or on Saturday if you use a token. ## Office Hours I'm happy to meet to discuss how things are going in the class, or to help with specific concepts if you are having trouble. Book a time at
. ## Reading I am working on a reading for Tuesday's class. I hope to have it posted on Friday.