Time complexity MCQsBy: Prof. Dr. Fazal Rehman | Last updated: May 14, 2025 20 Score: 0 Attempted: 0/20 Subscribe 1. What is the time complexity of accessing an element in an array by index? (A) O(n) (B) O(log n) (C) O(1) (D) O(n²) 2. What is the time complexity of inserting an element at the beginning of a linked list? (A) O(n) (B) O(log n) (C) O(1) (D) O(n²) 3. What is the best-case time complexity of quicksort? (A) O(n) (B) O(n log n) (C) O(n²) (D) O(log n) 4. What is the worst-case time complexity of quicksort? (A) O(n log n) (B) O(n) (C) O(n²) (D) O(log n) 5. What is the time complexity of searching for an element in a balanced binary search tree (BST)? (A) O(n) (B) O(log n) (C) O(1) (D) O(n log n) 6. What is the time complexity of merging two sorted arrays of size n? (A) O(n log n) (B) O(n) (C) O(log n) (D) O(n²) 7. What is the time complexity of deleting an element from a linked list given a pointer to that element? (A) O(1) (B) O(n) (C) O(log n) (D) O(n²) 8. What is the average-case time complexity of binary search? (A) O(n) (B) O(log n) (C) O(1) (D) O(n log n) 9. What is the time complexity of finding the maximum element in an unsorted array? (A) O(n log n) (B) O(n) (C) O(log n) (D) O(1) 10. What is the time complexity of the bubble sort algorithm in the worst case? (A) O(n) (B) O(n log n) (C) O(n²) (D) O(log n) 11. What is the time complexity of inserting an element into a max-heap? (A) O(n) (B) O(log n) (C) O(1) (D) O(n log n) 12. What is the time complexity of deleting the minimum element from a min-heap? (A) O(n) (B) O(log n) (C) O(1) (D) O(n log n) 13. What is the time complexity of traversing a binary tree? (A) O(n log n) (B) O(n) (C) O(log n) (D) O(n²) 14. What is the time complexity of the merge sort algorithm? (A) O(n log n) (B) O(n) (C) O(log n) (D) O(n²) 15. What is the time complexity of the selection sort algorithm? (A) O(n log n) (B) O(n) (C) O(log n) (D) O(n²) 16. What is the time complexity of searching for an element in an unbalanced binary search tree (BST)? (A) O(n) (B) O(log n) (C) O(1) (D) O(n log n) 17. What is the time complexity of checking if an element exists in a hash table with n elements? (A) O(n) (B) O(log n) (C) O(1) (D) O(n²) 18. What is the time complexity of the insertion sort algorithm in the best case? (A) O(n log n) (B) O(n) (C) O(log n) (D) O(n²) 19. What is the time complexity of deleting an element from an array, given its index? (A) O(1) (B) O(n) (C) O(log n) (D) O(n log n) 20. What is the time complexity of the Fibonacci sequence using dynamic programming? (A) O(n) (B) O(log n) (C) O(1) (D) O(n²) 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:Time complexity classes (P, NP, NP-complete, NP-hard) MCQsComplexity Analysis MCQsSpace complexity MCQsSpace complexity classes (PSPACE, L, NL) MCQsResearch Topics Ideas of Computational ComplexityWhite Box - Cyclomatic complexity