ALGORITHMS ACTUAL EXAM PAPER 2026
QUESTIONS WITH ANSWERS GRADED A+
◍ min-heap.
Answer: similar to a max-heap, but a node's key is less than or equal to its
children's keys.
◍ RemoveAfter.
Answer: operation removes the node after the specified list node. The
existing node must be specified because each node in a singly-linked list
only maintains a pointer to the next node.
◍ This stack reads left to right with the top to the right:
'green''yellow''blue''red' What could be the stack after a push operation?.
Answer: ['red','blue','yellow', 'green', 'purple"]
◍ compression.
Answer: transforms the data to use fewer bits.
◍ Which Format is Used to Store Data in a Hash Table?.
Answer: Array
◍ A function that maps data of arbitrary size to data of a fixed size.
Answer: Hash Function
◍ fast sorting algorithm.
Answer: A sorting algorithm that has an average runtime complexity of O(N
log N) or better.
◍ Instances Where Hash Tables May Be Resized.
Answer: High load factor, the number of collisions during an insertion
(open-addressing), and the size of a bucket's linked-list (chaining).
,◍ Insert in middle of list.
Answer: If the list's head pointer is not null (list not empty) and curNode
does not point to the list's tail node, the algorithm points the new node's next
pointer to curNode's next node, and then points curNode's next pointer to the
new node
◍ An example of why pre-order traversals are useful.
Answer: To create an identical copy of a tree
◍ Double Hashing Key Index Formula.
Answer: (h1(key)+i*h2(key))mod(tablesize)
◍ Function to Determine How Many Keys Will Be Mapped to Each Bucket.
Answer: num_keys/num_buckets
◍ reference count.
Answer: An integer counter that represents how many variables reference an
object.
◍ List Traversal.
Answer: An algorithm which visits all nodes in the list once and performs an
operation on each node.
◍ Feasibility.
Answer: Indicates that an algorithm is practical and capable of being
executed within reasonable constraints and resources.
◍ When to Use Recursion.
Answer: When a problem can naturally be divided into similar sub-problems
(e.g., tree traversal, searching algorithms like binary search).When the
recursive solution is significantly simpler or more intuitive than an iterative
one.
◍ Garbage collection.
Answer: automatic reclamation of memory occupied by objects that are no
longer referenced; It reclaims memory from data structures implemented
using linked allocations.
, ◍ Factors of an Algorithm.
Answer: ModularityCorrectnessMaintainabilityFunctionalityRobustnessUser-friendly
◍ A Last-in, First-out (LIFO) data container.
Answer: Stack
◍ Quicksort.
Answer: A sorting algorithm that repeatedly partitions the input into low and
high parts (each part unsorted), and then recursively sorts each of those
parts. To partition the input, it chooses a pivot to divide the data into low
and high parts.- Recursively breaks down a problem into two or more
subproblems of the same or related type
◍ Full.
Answer: A binary tree if every node contains 0 or 2 children.
◍ search.
Answer: algorithm returns the first node whose data matches that key, or
returns null if a matching node was not found.
◍ Push(PQueue, x).
Answer: Inserts x after all equal or higher priority itemsExample starting
with priority queue: 42, 61, 98 (front is 42)Push(PQueue, 87). PQueue: 42,
61, 87, 98
◍ dictionary.
Answer: key, value pair ADT
◍ full.
Answer: a bounded stack with a length equal to tue maximum length
◍ Which command will return true if x is in a list, otherwise return false?.
Answer: Contains(Object x)
◍ Min-Heap.
Answer: A data structure that is a tree that maintains the simple property that
a node's key is less than or equal to the node's childrens' keys.