Which of the following algorithm consumes less amount of RAM space during execution?
Optym technical mcq question, verified with a worked answer. Free to practise - no sign-up.
Which of the following algorithm consumes less amount of RAM space during execution?
Show answer & explanation
Single linked list sequential search requires only a single traversal pointer (O(1) auxiliary space) and has smaller per-node pointer overhead (1 pointer per node) compared to doubly linked lists (2 pointers per node) or graph traversals like BFS/DFS which store queues/recursion stacks.
Step-by-step Derivation:
Step 1: SLL sequential search operates with O(1) auxiliary memory using a single traversal pointer.
Step 2: Doubly linked list stores two pointers per node, taking more memory.
Step 3: BFS and DFS require auxiliary memory proportional to queue/stack size (up to O(V)).
Step 4: Therefore, Single linked list sequential search consumes the least RAM.