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 → Graphs 10

DFS explores?
Deep as possible along each branch before backtracking
click to copy
Time complexity of BFS (V vertices, E edges)?
O(V+E)
click to copy
Linked list graph representation?
Adjacency list
click to copy
Space complexity of adjacency matrix?
O(V²)
click to copy
Graph used in social networks?
Graph (users=vertices, connections=edges)
click to copy
BFS finds shortest path in?
Unweighted graphs
click to copy
DFS detects cycle using?
Back edge detection
click to copy
Maximum edges in undirected graph with 5 vertices?
10
click to copy
Number of edges in complete graph Kn?
n(n-1)/2
click to copy
Dijkstra's algorithm finds?
Single-source shortest path (non-negative weights)
click to copy

Data Structures and Algorithms → Introduction to DSA 20

Time complexity of DFS?
O(V+E)
click to copy
DAG stands for?
Directed Acyclic Graph
click to copy
Topological sort applies to?
DAG (Directed Acyclic Graphs)
click to copy
Kruskal's or Prim's algorithm finds?
Minimum Spanning Tree
click to copy
MST with n vertices has how many edges?
n-1
click to copy
Bipartite graph?
Divided into two sets, edges only between sets
click to copy
Euler path in graph?
Traverses every edge exactly once
click to copy
Hamiltonian path?
Every vertex exactly once
click to copy
Kosaraju's or Tarjan's algorithm finds?
Strongly Connected Components
click to copy
Bellman-Ford handles?
Single-source shortest path including negative weights
click to copy
Floyd-Warshall algorithm?
All-pairs shortest path
click to copy
Topological sort time complexity using DFS?
O(V+E)
click to copy
A data structure is?
Way to organize and store data for efficient access
click to copy
Linear data structure example?
Stack
click to copy
Non-linear data structure example?
Graph
click to copy
Linear DS elements are stored?
Sequentially, connected to prev and next
click to copy
In non-linear DS, element can connect to?
More than two
click to copy
Python dictionary is?
Collection of key-value pairs
click to copy
Average time complexity for Python dictionary search?
O(1)
click to copy
Space complexity of recursive algorithm depth n?
O(n) due to call stack
click to copy

Data Structures and Algorithms → Arrays 2

2D array graph representation?
Adjacency matrix
click to copy
Array is?
Elements of same type at contiguous memory locations
click to copy

Data Structures and Algorithms → Recursion 5

What is recursion?
Function calling itself
click to copy
What is the base case in recursion?
Condition that stops recursion
click to copy
Time complexity of factorial(n) using recursion?
O(n)
click to copy
Python default maximum recursion depth?
1000
click to copy
Tail recursion?
Recursive call is last operation
click to copy

Data Structures and Algorithms → Dynamic Programming 3

Memoization in recursion?
Caching results to avoid recomputation
click to copy
What is dynamic programming?
Optimization: solve overlapping subproblems, cache results
click to copy
DP approaches?
Memoization (top-down) and Tabulation (bottom-up)
click to copy