Space complexity MCQsBy: Prof. Dr. Fazal Rehman | Last updated: May 14, 2025 20 Score: 0 Attempted: 0/20 Subscribe 1. : What is space complexity? (A) The amount of memory an algorithm uses. (B) The amount of time an algorithm takes to complete. (C) The number of steps an algorithm performs. (D) The amount of data an algorithm processes. 2. : What is the space complexity of storing an array of n integers? (A) O(1) (B) O(n) (C) O(log n) (D) O(n^2) 3. : What is the space complexity of a function that uses a constant amount of extra space? (A) O(n) (B) O(log n) (C) O(1) (D) O(n^2) 4. : What is the space complexity of the recursive implementation of Fibonacci sequence without memoization? (A) O(1) (B) O(n) (C) O(n^2) (D) O(2^n) 5. : What is the space complexity of the iterative implementation of Fibonacci sequence? (A) O(1) (B) O(n) (C) O(n^2) (D) O(2^n) 6. : What is the space complexity of depth-first search (DFS) in a graph with n nodes and e edges using recursion? (A) O(n) (B) O(e) (C) O(n + e) (D) O(n^2) 7. : What is the space complexity of breadth-first search (BFS) in a graph with n nodes and e edges? (A) O(n) (B) O(e) (C) O(n + e) (D) O(n^2) 8. : What is the space complexity of merge sort? (A) O(n log n) (B) O(n) (C) O(log n) (D) O(n^2) 9. : What is the space complexity of quicksort in the worst case? (A) O(n log n) (B) O(n) (C) O(log n) (D) O(n^2) 10. : What is the space complexity of quicksort in the best case? (A) O(n log n) (B) O(n) (C) O(log n) (D) O(n^2) 11. : What is the space complexity of an algorithm that uses an auxiliary array of size n/2? (A) O(n/2) (B) O(n) (C) O(log n) (D) O(n^2) 12. : What is the space complexity of an algorithm that uses a stack for recursion and the depth of the recursion is n? (A) O(1) (B) O(n) (C) O(n log n) (D) O(n^2) 13. : What is the space complexity of storing a binary tree with n nodes? (A) O(1) (B) O(log n) (C) O(n) (D) O(n^2) 14. : What is the space complexity of dynamic programming solution for the knapsack problem with n items and capacity W? (A) O(n) (B) O(W) (C) O(nW) (D) O(n + W) 15. : What is the space complexity of an algorithm that uses an adjacency matrix to represent a graph with n nodes? (A) O(n) (B) O(n^2) (C) O(n log n) (D) O(n + e) 16. : What is the space complexity of an algorithm that uses an adjacency list to represent a graph with n nodes and e edges? (A) O(n) (B) O(n + e) (C) O(e) (D) O(n^2) 17. : What is the space complexity of a hash table with n elements? (A) O(1) (B) O(n) (C) O(log n) (D) O(n^2) 18. : What is the space complexity of a depth-first search (DFS) in a graph with n nodes and e edges using an iterative approach? (A) O(1) (B) O(n) (C) O(n + e) (D) O(n^2) 19. : What is the space complexity of the selection sort algorithm? (A) O(1) (B) O(n) (C) O(log n) (D) O(n^2) 20. : What is the space complexity of the insertion sort algorithm? (A) O(1) (B) O(n) (C) O(log n) (D) O(n^2) Data Structures MCQs Basic Concepts Introduction to Data Structures Abstract Data Types (ADT) MCQs Complexity Analysis MCQs Time complexity MCQs Space complexity MCQs Big O, Big Ω, Big Θ notations MCQs Linear Data Structures MCQs Arrays MCQs One-dimensional arrays MCQs Multi-dimensional arrays MCQs Operations: traversal, insertion, deletion MCQs Linked Lists MCQs Singly linked list MCQs Doubly linked list MCQs Circular linked list MCQs Stacks MCQs Stack operations (push, pop, peek) MCQs Applications of stacks (expression evaluation, recursion) MCQs Queues MCQs Queue operations (enqueue, dequeue, front, rear) MCQs Types: Simple queue, circular queue, priority queue, deque MCQs Non-Linear Data Structures MCQs Trees MCQs Binary trees MCQs Binary Search Trees (BST) MCQs AVL Trees MCQs B-trees and B+ trees MCQs Tree traversal methods (in-order, pre-order, post-order) MCQs Heaps MCQs Min-heap MCQs Max-heap MCQs Heap operations (insertion, deletion, heapify) MCQs Applications of heaps (priority queues, heap sort) MCQs Graphs MCQs Graph representation (adjacency matrix, adjacency list) MCQs Graph traversal algorithms (DFS, BFS) MCQs Shortest path algorithms (Dijkstra’s, Bellman-Ford) MCQs Minimum Spanning Tree (Kruskal’s, Prim’s) MCQs Hashing MCQs MCQs Hash Tables Hash functions MCQs Collision resolution techniques (chaining, open addressing) MCQs Applications of hashing MCQs Sorting and Searching Algorithms MCQs Sorting Algorithms MCQs Bubble sort MCQs Selection sort MCQs Insertion sort MCQs Merge sort MCQs Quick sort MCQs Heap sort MCQs Searching Algorithms MCQs Linear search MCQs Binary search MCQs Interpolation search MCQs Miscellaneous Memory Management in data structures MCQs Dynamic memory allocation MCQs Garbage collection MCQs String Manipulation Algorithms MCQs Pattern matching (KMP, Rabin-Karp) MCQs String hashing MCQs Data Structures MCQs 1 Data Structures MCQs 2 Data Structures MCQs 3 Data Structures MCQs 4 Data Structures MCQs 5 Stacks Solved MCQs Queues MCQs pointer mcqs Array MCQs Related Posts:Space complexity classes (PSPACE, L, NL) MCQsPaper Space vs Model Space AutoCAD MCQsComplexity Analysis MCQsTime complexity classes (P, NP, NP-complete, NP-hard) MCQsTime complexity MCQsResearch Topics Ideas of Computational Complexity