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 → Queue 14

Array-based queue is full when?
Q.head==Q.tail+1
click to copy
Queue using linked list IS_EMPTY checks?
Q.head==null
click to copy
What is a priority queue?
Each element has priority; higher served first
click to copy
Two types of priority queues are?
Min and Max priority queue
click to copy
In enqueue of linked list queue when empty?
New node both head and tail
click to copy
DEQUEUE in linked list: head becomes?
Q.head=Q.head.next
click to copy
Time complexity of enqueue and dequeue in linked list queue?
O(1)
click to copy
What is a deque?
Both front and rear insertion/deletion
click to copy
Initial head and tail in array queue class?
1
click to copy
After enqueue(10,20,30,40,50), dequeue(), dequeue() — remaining?
30,40,50
click to copy
During dequeue in linked list, which node is deleted?
Head (old front)
click to copy
Which algorithm uses queue for level-order traversal?
BFS/Level-order
click to copy
Priority queue most efficiently implemented with?
Binary Heap O(log n)
click to copy
Circular queue IS_FULL when?
head==tail+1
click to copy

Data Structures and Algorithms → Graphs 1

BFS uses which data structure?
Queue
click to copy

Data Structures and Algorithms → Introduction to DSA 13

Real-world example of queue?
Movie ticket queue (FIFO)
click to copy
OS job scheduling with equal priority uses?
Queue
click to copy
FRONT operation in queue:
Returns front without removing
click to copy
Printer spooling uses which data structure?
Queue
click to copy
Call center uses which structure to hold waiting customers?
Queue
click to copy
Minimum queues needed to implement a stack?
2
click to copy
What does 'head' pointer point to?
First element
click to copy
In doubly LL addNode(), when list is empty?
Both head and tail point to new node
click to copy
What is self.tail.next set to after adding node at end of doubly LL?
NULL/None
click to copy
In circular LL add() when empty, newNode.next=?
newNode itself
click to copy
Circular LL display() while loop stops when?
current.next!=self.head
click to copy
Doubly LL display() after adding 1,2,3,4,5?
1 2 3 4 5
click to copy
Circular LL advantage over singly LL?
Traverse entire list from any node
click to copy

Data Structures and Algorithms → Linked List 12

Two parts of a node in singly linked list?
data and next pointer
click to copy
Last node's 'next' in singly linked list points to?
NULL
click to copy
Advantage of linked list over arrays?
Dynamic size — no resizing needed
click to copy
Doubly linked list node has how many fields?
Three (prev, data, next)
click to copy
Advantage of doubly over singly linked list?
Traversal in both directions
click to copy
Disadvantage of doubly over singly linked list?
Extra pointer increases memory
click to copy
Circular linked list: tail node's 'next' points to?
Head node
click to copy
Previous pointer of head node in doubly linked list?
Points to None/NULL
click to copy
Next pointer of tail node in doubly linked list?
Points to None/NULL
click to copy
Time complexity of accessing element at index n in linked list?
O(n)
click to copy
Time complexity of insertion at head of linked list?
O(1)
click to copy
Best linked list for browser back-forward navigation?
Doubly
click to copy