Ten traced questions on stacks, hash tables, traversals, complexity, bubble sort, recursion, encapsulation, undecidability and BST deletion. Test your…
10 questions • Zestly
• A stack is used to reverse a string of characters. The stack starts empty. The following operations are performed in order: PUSH 'A', PUSH…
• A hash table has a size of 10 and uses the hash function h(k) = k MOD 10. You insert the keys 15, 25, and 35. If a collision occurs, you…
• Consider a binary tree with the following structure: Root is A. A has left child B and right child C. B has left child D and right child E…
• A graph has nodes 1, 2, 3, 4. Edges are: (1,2), (1,3), (2,4), (3,4). Starting at node 1, what is the order of nodes visited using a…
• Why is binary search considered to have a logarithmic time complexity, O(log n)?
• An array [5, 2, 9, 1, 5, 6] is being sorted using bubble sort. What is the state of the array after the first full pass?
• A recursive function is defined as: FUNCTION f(n) IF n = 0 THEN RETURN 1 ELSE RETURN n * f(n-1) ENDIF. What happens if the base case 'IF n…
• A class BankAccount stores a balance and provides methods deposit and withdraw. The balance field is declared private, so no code outside…
Want to check what you know — or test someone else?
Create your own quiz
See the full breakdown →