This data structure stores key-value pairs for fast lookup.
What is a map (or dictionary)?
The method used to add an item to a set in Python.
What is add()?
A priority queue is commonly used in this algorithm for finding the shortest path.
What is Dijkstra’s algorithm?
myset = {1, 2, 3, 3} → What will len(myset) return?
What is 3?
When you search for a value in a dictionary, Python uses this structure under the hood.
What is a hash table?
A set automatically removes these from its collection.
What are duplicates?
This method returns all the keys of a dictionary.
What is keys()?
A set would be useful in checking this kind of condition in data — for example, duplicate usernames.
What is uniqueness?
If we have the variables A = {1, 2, 3} and B = {2, 3, 4}, what does A - B return?
What is {1}?
In a max-heap, swapping continues upward until this condition fails.
What is the parent is greater than or equal to the child?
A heap is most often implemented using this underlying data structure.
What is an array or list?
The dictionary method that removes a key and returns its value.
What is pop()?
Heaps are often used to implement this data structure for handling priorities.
What is a priority queue?
students = {'A01': 'Mia', 'A02': 'John', 'A03':'Chris', 'A04':'Steve', 'A04':'James'} → What does students['A02'] return?
What is 'John'?
If a dictionary uses student IDs as keys and names as values, which is unique — the keys or the values?
What are keys?
The process of maintaining heap order after insertion or deletion.
What is heapify?
The set operation that combines all unique elements from two sets.
What is union()?
The process of moving an element up the heap until the property is restored.
What is bubble-up (or heapify-up)?
A = {1, 2, 3}; B = {3, 4, 5}; print(A & B) → Output?
What is {3}?
In a priority queue, tasks with higher priority numbers might come first — what type of heap is used for this?
What is max-heap?
This type of heap keeps the largest element at the root, unlike a min-heap.
What is max-heap?
In a priority queue, this operation always removes the element with the highest or lowest priority.
What is dequeue() or pop()?
A min-heap could be used by an operating system to decide which process to run next based on this property.
What is lowest priority value or shortest job?
A = {2, 4, 6, 8}
B = {4, 8, 12}
C = {8, 16}
result = (A | B) - (B & C)
print(sum(result))
This value will be printed as the output of this code.
What is 28?
If two keys in a dictionary are the same, what happens to the first value?
What is it gets overwritten?