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 27

Naive recursive Fibonacci time complexity?
O(2^n) exponential
click to copy
Time complexity of Python list append()?
O(1) amortized
click to copy
Hash collision is?
Two keys hash to same index
click to copy
Chaining in hash tables?
Colliding elements in linked list at same bucket
click to copy
Open addressing in hash tables?
Finding next available slot in array
click to copy
Load factor of hash table?
Elements/Buckets
click to copy
Heap data structure?
Complete binary tree with heap property
click to copy
Extract minimum from min-heap time complexity?
O(log n)
click to copy
Python module for heap operations?
heapq
click to copy
Time complexity of accessing element at index i in array?
O(1)
click to copy
Min-heap property?
Parent <= children
click to copy
Amortized time complexity?
Average cost per operation over sequence
click to copy
Python set membership check time complexity?
O(1) average
click to copy
Trie (prefix tree) is?
Tree storing strings, each node=character
click to copy
Trie search time complexity?
O(L) where L=word length
click to copy
Union-Find find() with path compression?
O(α(n)) ≈ O(1) amortized
click to copy
Red-Black tree is?
Self-balancing BST with red/black coloring rules
click to copy
LRU Cache best implementation?
Doubly Linked List + Hash Map
click to copy
Segment tree used for?
Range queries (sum/min/max) with efficient updates
click to copy
Fenwick tree (BIT) is?
Efficient prefix sum queries and point updates in O(log n)
click to copy
KMP algorithm used for?
String pattern matching in O(n+m)
click to copy
Timsort is?
Hybrid of merge sort and insertion sort
click to copy
Number of distinct BSTs with 3 keys?
5
click to copy
Comparison-based sorting lower bound?
O(n log n)
click to copy
All AVL operations time complexity?
O(log n)
click to copy
B+ tree used in databases because?
Faster range queries via linked leaves
click to copy
Timsort best case time complexity?
O(n) for already sorted
click to copy

Data Structures and Algorithms → Dynamic Programming 1

Fibonacci with memoization time complexity?
O(n)
click to copy

Data Structures and Algorithms → Recursion 2

Tower of Hanoi with n disks requires how many moves?
2^n - 1
click to copy
sys.setrecursionlimit() is used to?
Set maximum recursion depth
click to copy

Data Structures and Algorithms → Graphs 1

Tree vs graph difference?
Tree is connected acyclic graph with n-1 edges for n nodes
click to copy

Data Structures and Algorithms → Linked List 1

Time complexity of finding middle node of linked list?
O(n)
click to copy

Data Structures and Algorithms → Arrays 1

Insertion at beginning of array of n elements?
O(n)
click to copy

Data Structures and Algorithms → Trees 6

After inserting 1,2,3 into AVL tree, which rotation?
RR
click to copy
AVL tree LR rotation applied when?
New node in right of left child
click to copy
B-tree insertion always occurs at?
Leaf level
click to copy
Full B-tree node during insertion: operation performed?
Split at median, push median up
click to copy
B-tree of order 5: minimum keys in non-root node?
2
click to copy
Minimum degree t=2 B-tree: root has at least?
2 children
click to copy

Data Structures and Algorithms → Stack 1

Stack implementation using linked list advantage?
Never overflows (unless memory exhausted)
click to copy