Algorithms and Complexity MCQs (Part-5)

What does Dijkstra’s algorithm solve?

A Maximum flow
B Shortest path
C Minimum spanning tree
D Longest path

What is the primary advantage of Merge Sort?

A In-place sorting
B Simple to implement
C O(n log n) time
D Faster than Quick Sort

Which algorithm is used to find the minimum spanning tree?

A Quick Sort
B Bellman-Ford
C Binary Search
D Kruskal’s Algorithm

What is the worst-case time complexity of Quick Sort?

A O(n^2)
B O(n log n)
C O(log n)
D O(n)

Which of these algorithms uses the divide-and-conquer approach?

A Merge Sort
B Binary Search
C Quick Sort
D All of the above

What is the primary disadvantage of the Bubble Sort algorithm?

A Requires too much memory
B Does not handle sorted arrays
C Slow for large datasets
D Needs recursion

Which algorithm is typically used to find the shortest path in a graph with non-negative edge weights?

A Dijkstra’s Algorithm
B Bellman-Ford
C Floyd-Warshall
D Kruskal’s Algorithm

What is the space complexity of Merge Sort?

A O(1)
B O(n)
C O(log n)
D O(n log n)

What is the purpose of the Floyd-Warshall algorithm?

A Shortest path between two vertices
B Minimum spanning tree
C All-pairs shortest path
D Maximum flow

What is the time complexity of Heap Sort in the worst case?

A O(n log n)
B O(n^2)
C O(log n)
D O(n)

Which algorithm is used to find the largest element in a heap?

A Merge Sort
B Extract-Max
C Quick Sort
D Heapify

Which of these sorting algorithms is considered unstable?

A Merge Sort
B Bubble Sort
C Insertion Sort
D Heap Sort

What does Kruskal’s algorithm require to work efficiently?

A A priority queue
B A directed graph
C A sorted edge list
D A hash table

What is the primary purpose of the Bellman-Ford algorithm?

A Find shortest path in a graph
B Find minimum spanning tree
C Find the maximum flow
D Sort elements

Which algorithm is best suited for large datasets where the data is not already sorted?

A Quick Sort
B Bubble Sort
C Merge Sort
D Heap Sort