ALGORITHMS COMPREHENSIVE STUDY
GUIDE 2026 FULL QUESTIONS AND
SOLUTIONS GRADED A+
◍ Unbounded Queue.
Answer: a queue with a length that can grow indefinitely.
◍ Graphs.
Answer: -a data structure for representing connections among items
-Computer networks -Product recommendations -Social Networks-Are often
used to represent a geographic map, which can contain information about
places and travel routes
◍ Θ Notation.
Answer: Provides a growth rate that is both an upper and lower bound.
◍ Array:.
Answer: -Ordered and indexed collection of elements-Fixed-size
(Python)-Stored in contiguous memory locations-used when we require
random access to elements; when insertion & deletion are infrequent O(n)
◍ Tree.
Answer: A non-linear data structure that organizes data in a hierarchical
way.
◍ Append.
Answer: inserts the new node after the list's tail node. The append algorithm
behavior differs if the list is empty versus not empty:Append to empty list:
If the list's head pointer is null (empty), the algorithm points the list's head
and tail pointers to the new node.Append to non-empty list: If the list's head
, pointer is not null (not empty), the algorithm points the tail node's pointer to
the new node, points the new node's previous pointer to the list's tail node,
and points the list's tail pointer to the new node.
◍ Dijkstra's shortest path algorithm.
Answer: created by Edsger Dijkstra, determines the shortest path from a
start vertex to each vertex in a graph.
◍ Dijkstra's Shortest Path.
Answer: An algorithm that determines the shortest path from a start vertex
to each vertex in a graph.
◍ Dictionary.
Answer: Abstract Data Type - Dictionary (Map)Description - A dictionary is
an ADT that associates (or maps) keys with values.Common underlying data
structures - Hash Table, Binary Search TreeDictionaries contain references
to objects as key-value pairsEach key is associated with a value, much like
each word in a word dictionary stating a definition.Operations include:
my_dict[key]my_dict[key] = valuedel my_dict[key]key in my_dict
◍ modulo operator %.
Answer: common has function uses this. which computes the integer
remainder when dividing two numbers. Ex: For a 20 element hash table, a
hash function of key % 20 will map keys to bucket indices 0 to 19.
◍ Leaf.
Answer: A tree node with no children.
◍ Upper bound.
Answer: A function f(N) that is ≥ the worst case T(N), for all values of N ≥
1.
◍ range().
Answer: generates a sequence of numbers, starting at zero and ending before
a value given inside the parentheses. For example, for i in range(3) sets i to
0 during the first iteration of the for loop, i to 1 during the second iteration,
and finally i to 2 on the third iteration. The value within the parentheses is
, not included in the generated sequence.
◍ the traversal algorithm supports both singly-linked and doubly-linked lists..
Answer: true
◍ dict methods.
Answer: my_dict.clear()Removes all items from the dictionarymy_dict =
{'Bob': 1, 'Jane': 42}my_dict.clear()print(my_dict){}my_dict.get(key,
default)Reads the value of the key entry from the dict. If the key does not
exist in the dict, then returns default.my_dict = {'Bob': 1, 'Jane':
42}print(my_dict.get('Jane', 'N/A'))print(my_dict.get('Chad',
'N/A'))42N/Amy_dict1.update(my_dict2)Merges dictionary my_dict with
another dictionary my_dict2. Existing entries in my_dict1 are overwritten if
the same keys exist in my_dict2.my_dict = {'Bob': 1, 'Jane':
42}my_dict.update({'John': 50})print(my_dict){'Bob': 1, 'Jane': 42, 'John':
50}my_dict.pop(key, default)Removes and returns the key value from the
dictionary. If key does not exist, then default is returned.my_dict = {'Bob':
1, 'Jane': 42}val = my_dict.pop('Bob')print(my_dict){'Jane': 42}
◍ PrintReverse(list).
Answer: Prints list's items in reverse orderPrintReverse(list) outputs: 77, 99
◍ What did the term 'computer' originally refer to?.
Answer: A person performing computations by hand
◍ Scope.
Answer: the area of code where a name is visible.
◍ A function that has two inputs that contribute to growth.
Answer: O(nm)
◍ Positional list.
Answer: A list where elements contain pointers to the next and/or previous
elements in the list.
◍ Parent.
Answer: A node with a child is said to be that child's parent.