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 → Linked List 8

Time complexity of reversing a singly linked list?
O(n)
click to copy
When to prefer doubly over singly linked list?
Deletion given only node pointer (no prev traversal)
click to copy
append() method in linked list adds where?
Tail (last_node)
click to copy
display() in linked list uses?
while current=current.next
click to copy
Which is NOT a type of linked list?
Binary
click to copy
One pair of linked list item + reference = ?
Node
click to copy
Linked list doesn't require:
Contiguous memory allocation
click to copy
Linked list search time complexity?
O(n)
click to copy

Data Structures and Algorithms → Queue 1

Stack and Queue can be implemented using?
Both arrays and linked lists
click to copy

Data Structures and Algorithms → Introduction to DSA 12

Floyd's cycle detection uses?
Slow and fast pointer
click to copy
In circular LL with 4 nodes A,B,C,D starting at A, node after 5 steps?
B
click to copy
Topmost node of a tree?
Root
click to copy
Nodes with no children are called?
Leaf nodes
click to copy
Degree of a node?
Maximum number of children
click to copy
Level of root node?
0
click to copy
Inorder predecessor is?
Largest in left child
click to copy
Inorder successor is?
Smallest in right child subtree
click to copy
LL rotation: every node moves?
One position left
click to copy
RR rotation: every node moves?
One position right
click to copy
LR rotation is combination of?
Single left then single right rotation
click to copy
RL rotation is combination of?
Single right then single left rotation
click to copy

Data Structures and Algorithms → Trees 10

Maximum children in binary tree?
2
click to copy
What is a full binary tree?
Every node 2 children except leaves
click to copy
What is a complete binary tree?
Filled level-by-level left to right
click to copy
Inorder traversal visits in order?
Left-Root-Right
click to copy
Preorder traversal visits in order?
Root-Left-Right
click to copy
Postorder traversal visits in order?
Left-Right-Root
click to copy
AVL tree is?
Height-balanced BST; balance factor -1,0,+1
click to copy
Balance factor in AVL tree?
Height of left - height of right subtree
click to copy
AVL tree introduced by?
G.M. Adelson-Velsky and E.M. Landis
click to copy
How many rotation types in AVL tree?
4
click to copy

Data Structures and Algorithms → Arrays 3

Left child of node i in array representation?
2i
click to copy
Right child of node i in array representation?
2i+1
click to copy
Parent of node i in array representation?
floor(i/2)
click to copy

Data Structures and Algorithms → Binary Search Tree 6

BST left subtree contains?
Smaller values
click to copy
BST right subtree contains?
Larger values
click to copy
Time complexity of BST search (balanced)?
O(log n)
click to copy
Time complexity of BST search (worst case skewed)?
O(n)
click to copy
New nodes in BST always inserted as?
Leaf nodes
click to copy
BST Case 3 deletion handles?
Node with two children
click to copy