Quick Revision

GK One-Line Question & Answer

15541+ short questions with short answers, covering every category and sub-category on the site — no long articles to scroll through. Good for a fast recap before an exam, or a few minutes of daily practice.

Data Structures and Algorithms → Introduction to DSA 13

How many comparisons does binary search make for 1024 elements (worst case)?
10
click to copy
Binary search cannot be applied efficiently to which data structure?
Sorted linked list
click to copy
Which search uses position estimation based on value distribution?
Interpolation search
click to copy
Which search has O(log log n) average time complexity?
Interpolation
click to copy
In binary search, when element == middle element:
Element found, return index
click to copy
Loop condition in iterative binary search:
while low <= high
click to copy
What is ternary search?
Divides into 3 parts
click to copy
question
option_a
click to copy
Which has same O(n log n) in best, average, worst case?
Merge
click to copy
What does 'stable sorting' mean?
Equal elements keep original relative order
click to copy
Which algorithm is most efficient for nearly sorted data?
Insertion sort
click to copy
Counting sort is best for:
Integers with small known range
click to copy
Python's list.sort() vs sorted(list) — key difference?
list.sort() in-place; sorted() returns new list
click to copy

Data Structures and Algorithms → Graphs 2

DFS graph traversal uses which data structure?
Stack
click to copy
BFS graph traversal uses which data structure?
Queue
click to copy

Data Structures and Algorithms → Searching Algorithms 1

Average case time complexity of linear search?
O(n)
click to copy

Data Structures and Algorithms → Sorting Algorithms 23

Bubble sort is also known as:
Sinking sort
click to copy
Worst case time complexity of bubble sort?
O(n²)
click to copy
Best case time complexity of optimized bubble sort?
O(n)
click to copy
Swap condition in bubble sort for ascending order:
list[i]>list[i+1]
click to copy
Selection sort works by:
Finding min and placing at correct position
click to copy
Time complexity of selection sort?
O(n²)
click to copy
For descending order in selection sort, use:
max()
click to copy
Insertion sort is best for:
Small and nearly sorted data
click to copy
Best case time complexity of insertion sort?
O(n)
click to copy
Merge sort uses which paradigm?
Divide and Conquer
click to copy
Time complexity of merge sort?
O(n log n)
click to copy
Space complexity of merge sort?
O(n)
click to copy
Quick sort uses which element as reference?
Pivot (first/last/random/median)
click to copy
Average case time complexity of quick sort?
O(n log n)
click to copy
Worst case time complexity of quick sort?
O(n²)
click to copy
Which sorting algorithm is NOT stable?
Standard Quick sort
click to copy
Space complexity of bubble sort?
O(1)
click to copy
Heap sort uses which data structure?
Binary Heap
click to copy
Selection sort performs at most how many swaps for n elements?
n-1 swaps
click to copy
Radix sort time complexity?
O(nk) where k=number of digits
click to copy
After sorting [5,3,7,1,9,6] using selection sort, first element placed?
1
click to copy
How many passes does bubble sort need worst case for n elements?
n-1
click to copy
In quick sort, elements smaller than pivot go to:
Left side
click to copy

Data Structures and Algorithms → Recursion 1

Base case for merge sort recursion?
len>1
click to copy