(Weeks 01-05)
The conditional that ends a recursive function.
What is the base case?
A FIFO data structure that keeps order.
What is a Queue?
Identify the time complexities that we have covered this semester.
O(N^2), O(N), O(NlogN), O(logN), O(1)
For a block that needs to run as long as a given condition is true, one would most likely use the following kind of loop.
What is a while loop?
Determine the shape does the following Turtle code draws.
for _ in range(4):
turtle.fd(100)
turtle.lt(90)
What is a square?
The three loop mechanisms we covered.
What are for loops, while loops, and recursion?
A Python implementation of a hash table.
What is a dictionary?
A stable and optimal sorting algorithm.
What is MergeSort?
The type of data structure that a recursive function would be most appropriate for.
What is a recursive data structure?
This method when called with no arguments removes all whitespace (tabs, spaces, newlines, etc) from a string on both ends.
What is strip()?
This keyword is used to exit from a loop.
What is 'break'?
A tree with two child nodes, one less in value and one greater in value than the parent.
What is a Binary Search Tree (BST)?
Identify the two search algorithms we have covered.
What are Linear and Binary Search?
To keep track of the progress on a shopping list (how many items we have so far) one would most optimally use which data structure?
What is a set?
The method of making a dataclass instance immutable
What is frozen=True?
The purpose of this code:
with open("file.txt", "r") as f:
for line in f:
print(line.split())
What is printing every line in a file?
A process for lowering collisions in a hash table, without modifying the hash function
What is rehashing?
List the following algorithms in descending order by time complexity:
Merge Sort
Binary Search
Insertion Sort
Merge Sort, Insertion Sort, Binary Search
For immutable, ordered collections, one would use this data structure.
What is a tuple?
What a Python function returns when it returns multiple values.
What is a tuple return?
The output of this code:
"Something"[:4] + "Something"[4:]
What is "Something"?
All recursive problems can be solved iteratively using this data structure.
What is a stack?
Consider an algorithm that bisects the list for every element within it.
Determine the Big O notation for the time complexity of this algorithm.
What is O(NLogN)?
To keep track of a thing with multiple named parts, one would use this data structure.
What is a dataclass?
These are the three types of errors.
What are syntax, runtime, and semantic errors?