Stack
A stack is LIFO (push, pop). It is used for function calls, undo, and expression conversion and evaluation.
What the subject covers, the key topics, how it has been asked, common mistakes and a two-week plan.
IBPS publishes no official syllabus; this list is based on previous papers.
Ways to organise data in memory (arrays, lists, trees, graphs, hash tables).
Step-by-step methods that work on them (searching, sorting, traversing, optimising).
The exam tests whether you know how each structure behaves, how fast each algorithm is (Big-O), and whether you can trace small examples by hand.
Tap a term to open its definition.
| Notation | Bound |
|---|---|
| Big-O | An upper bound |
| Ω | A lower bound |
| Θ | A tight bound |
Common orders, from fastest-growing down: n!, 2ⁿ, n², n log n, n, log n, 1.
| Recurrence | Gives | As in |
|---|---|---|
| T(n) = 2T(n/2) + n | O(n log n) | Merge sort |
| T(n) = T(n/2) + 1 | O(log n) | Binary search |
| Compared | Array | Linked list |
|---|---|---|
| Access | O(1) access by index | Access costs O(n) |
| Insert | Inserting in the middle costs O(n) | Inserts in O(1) once you hold the node |
Variants: singly, doubly and circular lists.
A stack is LIFO (push, pop). It is used for function calls, undo, and expression conversion and evaluation.
A queue is FIFO. Variants: circular queue, deque, priority queue.
infix a + b * c
postfix a b c * +Infix becomes postfix this way because * binds tighter.
Evaluate postfix left to right: push operands, and on each operator pop two (the right operand first, then the left: for a b − compute a − b) and push the result.
Arrays, lists, stacks and queues are linear. Trees and graphs are non-linear.
Binary tree facts: at most 2ˡ nodes on level l (root = level 0); at most 2ʰ⁺¹ − 1 nodes in a tree of height h; with n nodes there are n − 1 edges.
| Traversal | Order |
|---|---|
| Preorder | Root, left, right |
| Inorder | Left, root, right |
| Postorder | Left, right, root |
| Level order | Uses a queue |
Left < node < right. Search, insert and delete are O(h): O(log n) when balanced, O(n) when skewed, for example after inserting sorted keys.
A self-balancing BST: each node's balance factor (left height − right height) is −1, 0 or +1. Insertions are fixed with LL, RR, LR and RL rotations.
The fewest nodes an AVL tree of height h can have follows
N(h) = N(h−1) + N(h−2) + 1
N(0) = 1, N(1) = 2 (a single node has height 0)
so N(2) = 4, N(3) = 7, N(4) = 12A complete binary tree stored in an array. In a max-heap every parent ≥ its children.
Heap indexes and costs: with 0-based indexes, the children of i are 2i + 1 and 2i + 2. Insert and delete-max are O(log n); building a heap is O(n).
Also: B and B+ trees (see DBMS), tries (prefix search), spanning trees.
| Compared | Adjacency matrix | Adjacency list |
|---|---|---|
| Space it takes | O(V²) | O(V + E) |
| What it gives | O(1) edge lookup | Suits sparse graphs |
| Compared | BFS | DFS |
|---|---|---|
| Uses | A queue | A stack or recursion |
| Also | Finds shortest paths in unweighted graphs | not stated |
Both are O(V + E) with adjacency lists.
| Algorithm | What to know |
|---|---|
| Dijkstra | Non-negative weights only |
| Bellman-Ford | Handles negative edges and detects negative cycles |
| Floyd-Warshall | All pairs, O(V³) |
Prim grows from a vertex; Kruskal adds the cheapest edges that don't form a cycle (union-find). An MST of V vertices has V − 1 edges.
Topological sort orders the vertices of a directed acyclic graph (DAG).
| Algorithm | Best | Average | Worst | Extra space | Stable |
|---|---|---|---|---|---|
| Bubble (with early exit) | n | n² | n² | 1 | Yes |
| Selection | n² | n² | n² | 1 | No |
| Insertion | n | n² | n² | 1 | Yes |
| Merge | n log n | n log n | n log n | n | Yes |
| Quick | n log n | n log n | n² | log n average (n worst case) | No |
| Heap | n log n | n log n | n log n | 1 | No |
All complexities in the table are O(·).
Selection sort makes at most n − 1 swaps, the fewest among the simple in-place sorts.
Merge, heap and selection sort take the same time in every case.
Insertion sort is fast on nearly sorted data.
Quick sort's worst case comes from bad pivots, for example an already sorted array with the first element as pivot.
| Search | Time | Needs |
|---|---|---|
| Linear search | O(n) | not stated |
| Binary search | O(log n) | Sorted data |
Basics: a hash function maps a key to a slot.
The load factor α = number of stored keys ÷ number of slots.
| Method | How |
|---|---|
| Chaining | Keeps a list per slot |
| Open addressing | Probes for another slot: linear probing (causes primary clustering), quadratic probing, or double hashing |
| Technique | Idea | Examples |
|---|---|---|
| Divide and conquer | Split, solve the parts, combine | Merge sort, quick sort, binary search |
| Greedy | Take the best local choice each step | Kruskal, Prim, Huffman coding, fractional knapsack |
| Dynamic programming | Overlapping subproblems plus optimal substructure | 0/1 knapsack, longest common subsequence (O(mn)), longest increasing subsequence (O(n²) with the classic double loop, O(n log n) with binary search) |
| Backtracking | not stated | N-queens, subsets |
| Compared | Memoization | Tabulation |
|---|---|---|
| Direction | Top-down | Bottom-up |
| How | Caches the results of recursive calls so each subproblem is solved once | Fills a table |
These are the facts about the format from the official IBPS documents:
Sources: IBPS official notification CRP SPL-XVI (1 Jul 2026); IBPS Information Handout, Online Main Exam CRP SPL-XVI, “notification §D; handout, Professional Knowledge sample question”
IBPS doesn't publish past papers. Based on memory-based papers shared by candidates (unofficial) for two previous IT Officer Mains exams (January 2023 and December 2024; possibly incomplete), data-structure questions were mostly short and exact:
We don't give a number of questions, because IBPS publishes no weightage.
A suggestion. Adjust it to your own pace.
Big-O, recurrences
Practice: Rank 10 functions by growth; solve 5 recurrences
Arrays, linked lists, stacks, queues
Practice: Infix → postfix and postfix evaluation, 10 a day
Binary trees, traversals, BST, AVL rotations, heaps
Practice: Build a BST from a key list; write all 4 traversals; insert into an AVL with rotations
Graphs: representation, BFS, DFS, Dijkstra, MST
Practice: Run each algorithm by hand on a 6-vertex graph
Searching and sorting
Practice: Fill the complexity table from memory; trace one pass of each sort
Hashing
Practice: Insert keys with linear probing and with chaining
Divide and conquer, greedy, DP, backtracking
Practice: Classify 20 problems by technique
Mixed revision
Practice: Timed set of 25 questions in 20 minutes; review every wrong answer
| Days | Focus | Practice |
|---|---|---|
| 1 | Big-O, recurrences | Rank 10 functions by growth; solve 5 recurrences |
| 2–3 | Arrays, linked lists, stacks, queues | Infix → postfix and postfix evaluation, 10 a day |
| 4–6 | Binary trees, traversals, BST, AVL rotations, heaps | Build a BST from a key list; write all 4 traversals; insert into an AVL with rotations |
| 7–8 | Graphs: representation, BFS, DFS, Dijkstra, MST | Run each algorithm by hand on a 6-vertex graph |
| 9–10 | Searching and sorting | Fill the complexity table from memory; trace one pass of each sort |
| 11 | Hashing | Insert keys with linear probing and with chaining |
| 12 | Divide and conquer, greedy, DP, backtracking | Classify 20 problems by technique |
| 13–14 | Mixed revision | Timed set of 25 questions in 20 minutes; review every wrong answer |
48 terms
No term matches. Try a shorter word.
8 topics. Practice questions: 0 so far, 2-mark questions coming soon.
Coming soon 0 practice questions
Practise ArraysComing soon 0 practice questions
Practise Linked listsComing soon 0 practice questions
Practise Stacks and queuesComing soon 0 practice questions
Practise Trees (BST, AVL, heaps)Coming soon 0 practice questions
Practise Graphs (BFS, DFS, shortest path)Coming soon 0 practice questions
Practise Sorting and searchingComing soon 0 practice questions
Practise HashingComing soon 0 practice questions
Practise Big-ONo. The exam is multiple choice. You need to know how the structures behave and be able to trace small examples by hand: traversals, conversions and complexities.
Bubble, selection, insertion, merge, quick and heap sort, with best, average and worst-case times, extra space, and whether each is stable.
In the memory-based papers we read (shared by candidates, unofficial), yes, at the level of concepts: what memoization does and the complexity of a classic DP solution. Know the idea and a few standard examples.
IBPS doesn't say. Professional Knowledge has 50 questions in total for 100 marks; the split across subjects isn't published.
Professional Knowledge topics by subject
Prelims, Mains, descriptive and interview
Age and qualification, from the notification