Dictionaries and Sets
Queues and Stacks
Dataclasses
Time Complexity
SI Trivia
100

What is the syntax for creating a new dictionary?

newdict = dict()

or

newdict = {}

100

Which of the following acronyms best describes a stack? 

FIFO FOFI LIFO LOFI


Last in, first out 

LIFO

100

Name one benefit of making your own dataclass versus a pre-existing dataclass.

There is more flexibility because you choose what data it can hold

100

Insertion Sort

O(N^2)


100

What is Ren's favorite crime?

Arson

200

True or False:

“A set does not preserve order”


True

200

Which of the following acronyms best describes a queue? 

FOFI LIFO FAFI LOFI FIFO

First in, first out

FIFO

200

Change Garfield's age to 7 

@dataclass

class Cat : 

    str : name

    int : age

my_cat = Cat( "Garfield", 6 )


my_cat.age = 7

200

Finding the value of a key in a dictionary.

O(1)

200

What email sendoff does Ren use most often?

"Cheers,"

or

"Have a great day, and I hope to see you there! :-)"

300

True or False:

“Python dictionaries cannot have duplicate values”


False

300

Draw a box-and-pointer diagram representing this stack:

my_stack = make_empty_stack()

push(my_stack, 5)

push(my_stack, 7)

push(my_stack, 1)

push(my_stack, 8)

pop(my_stack)


300

What are the two attributes (and their types) of a basic linked list?

Head: MutableNode //or LinkedNode

size: int


300

Searching for a value in a sorted list using binary search.

O(log(N))

300

What does "SI" stand for?

Supplemental Instruction

400

What is the time complexity of indexing the value of a given key?

O(1)

400

Using the given CS functions write a function that removes all elements from the stack and prints the values in the stack.

def empty(my_stack):

    while not is_empty(my_stack):

        print(pop(my_stack))

400

Make a class named Person, whose attributes are name and age. Then create Ren :-)

@dataclass

class Person:     

   str : name                     

   int : age

ren = Person(“Ren”, 22)


400

Remove an element from an linked list.

O(N)

400

What activity consistently takes more time than planned during sessions?

Basic Overview

500

Write a function that loops through a given dictionary’s keys to print the values.

def looper(d):

        for key in d:*

                print(d[key])

*could also be "for key in d.keys:"

500

Using the queue dataclass we covered in class, write a line of code to create an empty queue without using the make_empty_queue function.

my_queue = Queue( None, None, 0 )

500

@dataclass

class Hat:

    str: color

@dataclass

class Kid :

    str : name

    int : age

    Hat : hat

Create a kid named Ash, 10 years old, with a red hat.

new_kid = Kid( “Ash”, 10, Hat (“red”))

I just wany y'all to know that I didn't even make this Jeopardy, just edited it some, and yet there's a Pokémon reference in here. Amazing.

500

Using this algorithm to find an element in a list:

Use quick sort on an unsorted list and then perform binary search

O(Nlog(N))

500

What flower was centric to the Week 6 (Exam 1) session slides?

BONUS: What was the meaning of this flower?

Sweetbay magnolia AKA Swamp magnolia 

Perseverance