Probability Engine · MDS 502

Data Structures and Algorithms: the questions likely to come

91 analyzed questions from 13 past papers (5 board exams, 2078-2082), grouped by syllabus unit — each with its probability, how often it's been asked, and where to study the answer.

13
Papers analyzed
incl. 5 board exams · 2078-2082
91
Analyzed questions
across 8 syllabus units
35%
Board marks from repeats
questions asked before
6
Units = 80% of marks
study these first
Model answers for this subject are being written. Every question links to its original paper so you can study from the source meanwhile.
Which exams to include?Showing: Board only (default)
Pick a unit
U8 · Q1/10 · 20826 marks
Trees and Graphs

What is AVL tree. Construct AVL tree for the sequence 23, 30, 39, 11, 7, 17, 28, and 18. (1 + 5)

54%
Possible to appearAppeared in 3 of the last 3 board papers
Seen in
How well do you know this?rating moves you on
MODEL ANSWERU8 · 6 marks

AVL Tree

An AVL tree is a self-balancing binary search tree in which, for every node, the heights of its left and right subtrees differ by at most 1. The balance factor BF=hlefthrightBF = h_{left} - h_{right} must be in {1,0,+1}\{-1, 0, +1\}. After every insertion/deletion that violates this, balance is restored by one of four rotations: LL (single right), RR (single left), LR (left-right), RL (right-left). This guarantees height O(logn)O(\log n), so search/insert/delete are O(logn)O(\log n).

Construct AVL Tree for: 23, 30, 39, 11, 7, 17, 28, 18

Insert 23, 30:

  23
    \
     30

Insert 39 — 23 becomes unbalanced (BF = -2), right-right case → RR rotation (left) about 23:

     30
    /  \
   23   39

Insert 11, 7 — inserting 7 makes 23 unbalanced (BF = +2), left-left case → LL rotation (right) about 23:

        30
       /  \
      11   39
     /  \
    7    23

Insert 17 — goes left of 23. Check ancestors: node 11 has BF = +1, node 30 has BF = +2 (left heavy) and the insertion is in the left subtree's right side → LR case. First left-rotate 11, then right-rotate 30:

        23
       /  \
      11   30
     / \     \
    7  17     39

Insert 28 — goes left of 30 (right child of 23). Tree stays balanced (all BFs in range):

        23
       /  \
      11   30
     / \   / \
    7  17 28  39

Insert 18 — goes right of 17. Now check ancestors of 18: node 17 BF = -1, node 11 BF = -2 (right heavy) and insertion is in the right subtree's left side → RL case about 11. First right-rotate 17... since 17's right child 18 is the imbalance, RL = right-rotate(17's child) then left-rotate(11). Result lifts 17 up:

          23
         /  \
       17    30
      /  \   / \
     11  18 28  39
    /
   7

Final AVL Tree

          23
         /  \
       17    30
      /  \   / \
     11  18 28  39
    /
   7

Verification of balance factors:

  • 7: leaf, BF = 0
  • 11: left height 1, right 0 → BF = +1 ✓
  • 18: leaf, BF = 0
  • 17: left height 2, right 1 → BF = +1 ✓
  • 28, 39: leaves, BF = 0
  • 30: BF = 0
  • 23 (root): left height 3, right height 2 → BF = +1 ✓

All balance factors lie in {1,0,+1}\{-1, 0, +1\}, so the tree is a valid AVL tree.

AI-generated answerView in 2082 paper →
U8 · Question 1 of 10
Question Priority · U8ranked by appearance likelihood — study top-down

Trees and Graphs

Analyzed next54%
1
★ TOP PICK

What is AVL tree. Construct AVL tree for the sequence 23, 30, 39, 11, 7, 17, 28, and 18. (1 + 5)

6 marksSEEN IN
54%
2

Define minimum spanning tree. Explain Prim's algorithm to find minimum spanning tree with suitable example. (1 + 5)

6 marksSEEN IN
24%
3

Use Dijkstra's shortest path algorithm to find the shortest path between the vertices a and z in the graph given below. (6)

Graph (undirected, weighted) with vertices a, b, c, d, e, z and edges: a–b = 2, a–c = 3, b–d = 5, b–e = 2, c–e = 5, d–e = 1, d–z = 2, e–z = 4.

6 marksSEEN IN
22%
4

Starting with empty binary search tree, show the effect of successively adding the following numbers as keys: 20, 23, 10, 21, 30, 15, 5, 22 and 40. Also, traverse this tree in preorder and postorder. (4 + 2)

6 marksSEEN IN
20%
5

Define spanning tree and minimum spanning tree. Explain Kruskal's algorithm to find minimum spanning tree with suitable example. (2 + 4)

6 marksSEEN IN
20%
6

What is spanning tree? Explain minimum spanning tree in brief. (1 + 2)

3 marksSEEN IN
39%
7

Explain almost complete binary tree with example. (3)

3 marksSEEN IN
39%
8

Explain postorder traversal with example.

3 marksSEEN IN
24%
9

Explain adjacency matrix representation of a graph. How is it different from incidence matrix representation? (2 + 1)

3 marksSEEN IN
24%
10

Explain preorder traversal with example. (3)

3 marksSEEN IN
22%
03The mock

Sit a probable paper

A full mock exam built from the most likely questions, mirroring the real paper's structure. Every slot is a real past question.

Most Probable Paper

Mirrors the real structure · 45 marks · based on 5 past papers

Group A
  1. 1.

    Explain binary search algorithm with example. (3)

    [3 marks]
    Searching and HashingVery likelyfrom 2079 paper →

    This question has recurred in 2 of 5 years; including the board exam 2× (2078 to 2079); and its topic (Searching and Hashing) appears in 100% of years.

  2. 2.

    Compare linear search with binary search? What are their time complexities? (2 + 1)

    [3 marks]
    Searching and HashingVery likelyfrom 2078 paper →

    This question has recurred in 3 of 5 years; including the board exam 1× (2078); and its topic (Searching and Hashing) appears in 100% of years.

  3. 3.

    Define spanning tree and minimum spanning tree. (1.5 + 1.5)

    [3 marks]
    Trees and GraphsVery likelyfrom 2080 paper →

    This question has recurred in 2 of 5 years; including the board exam 1× (2080); and its topic (Trees and Graphs) appears in 80% of years.

  4. 4.

    Explain almost complete binary tree with example. (3)

    [3 marks]
    Trees and GraphsVery likelyfrom 2082 paper →

    This question has recurred in 2 of 5 years; including the board exam 1× (2082); and its topic (Trees and Graphs) appears in 80% of years.

  5. 5.

    What is hashing? Explain open hashing. (1 + 2)

    [3 marks]
    Searching and HashingVery likelyfrom 2078 paper →

    This question has recurred in 2 of 5 years; including the board exam 1× (2078); and its topic (Searching and Hashing) appears in 100% of years.

Group B
  1. 1.

    What is AVL tree. Construct AVL tree for the sequence 21, 26, 30, 9, 4, 14, 28, and 18. (1 + 5)

    [6 marks]
    Trees and GraphsVery likelyfrom 2082 paper →

    This question has recurred in 3 of 5 years; including the board exam 3× (2080 to 2082); and its topic (Trees and Graphs) appears in 80% of years.

  2. 2.

    How do you insert and remove nodes in a singly linked list? (6)

    [6 marks]
    ListsVery likelyfrom 2082 paper →

    This question has recurred in 3 of 5 years; including the board exam 1× (2082); and its topic (Lists) appears in 100% of years.

  3. 3.

    Explain tail recursion with suitable program. (6)

    [6 marks]
    RecursionVery likelyfrom 2079 paper →

    This question has recurred in 3 of 5 years; including the board exam 1× (2079); and its topic (Recursion) appears in 100% of years.

  4. 4.

    Explain algorithm for converting an infix expression to postfix using stack. Use this algorithm to convert (A+BC)D(A + B - C) * D to postfix. (4 + 2)

    OR

    List some applications of stack. Explain algorithm for evaluating a postfix expression using stack with suitable example. (1.5 + 4.5)

    [6 marks]
    StackVery likelyfrom 2080 paper →

    This question has recurred in 2 of 5 years; including the board exam 1× (2080); and its topic (Stack) appears in 100% of years.

  5. 5.

    What is header node in linked list? Explain circular linked list with example. (2 + 4)

    [6 marks]
    ListsVery likelyfrom 2078 paper →

    This question has recurred in 2 of 5 years; including the board exam 1× (2078); and its topic (Lists) appears in 100% of years.

04The receipts

Behind the numbers

The raw evidence the predictions are computed from: marks per unit per year, syllabus weights, trends, and coverage.

Show the heatmap, topic table and coverage analysis

The receipt: marks per unit, per year

Each row is a syllabus unit, each column an exam year, each cell the marks that unit earned that year. Click any cell to see the actual questions behind it.

Marks:nonefew → many
2078
2079
2080
2081
2082
Total
U8Trees and Graphs
57
U5Lists
48
U7Searching and Hashing
42
U6Sorting
27
U2Stack
21
U3Queue
12
U1Introduction to Data Structures & Algorithms
12
U4Recursion
6
#Syllabus unitProbabilityAppearedAvg marksSyllabus weightExam vs syllabusTrendQuestions
1U8Trees and GraphsVery likely80%4.817%8 lecture hrsBalancedexam 17% · syllabus 17%Rising1 recurring10 total
2U5ListsVery likely100%4.817%8 lecture hrsBalancedexam 16% · syllabus 17%Steadynone repeat10 total
3U7Searching and HashingVery likely100%4.215%7 lecture hrsBalancedexam 13% · syllabus 15%Steady1 recurring9 total
4U6SortingVery likely80%5.417%8 lecture hrsUnder-examinedexam 9% · syllabus 17%Risingnone repeat5 total
5U2StackVery likely80%5.312%6 lecture hrsBalancedexam 16% · syllabus 12%Fadingnone repeat4 total
6U3QueueVery likely60%48%4 lecture hrsBalancedexam 10% · syllabus 8%Steadynone repeat3 total
7U1Introduction to Data Structures & AlgorithmsVery likely80%36%3 lecture hrsBalancedexam 9% · syllabus 6%Fadingnone repeat4 total
8U4RecursionVery likely40%38%4 lecture hrsBalancedexam 10% · syllabus 8%Fadingnone repeat2 total
20783 sittings
first reassessmentmid-termpre board
20791 sitting
board
20803 sittings
boardfirst assessmentsecond assessment
20814 sittings
boardfirst assessmentsecond assessment
20822 sittings
boardsecond assessment

Study smart, not hard

Drag the slider: studying the top 6 units in priority order covers ~82% of all observed marks.

  1. ~80% line

Lecture time vs exam marks

Where the exam pays more than the curriculum spends: ● lectures vs ● exam marks, as a share of the whole course. A long teal-leading bar = high-yield unit.

U2Stack
12% of lectures → 16% of marks
U5Lists
17% of lectures → 16% of marks
U8Trees and Graphs
17% of lectures → 17% of marks
U7Searching and Hashing
15% of lectures → 13% of marks
U3Queue
8% of lectures → 10% of marks
U4Recursion
8% of lectures → 10% of marks
U1Introduction to Data Structures & Algorithms
6% of lectures → 9% of marks
U6Sorting
17% of lectures → 9% of markslow yield

Topics are the official MDS 502 syllabus units. Predictions are data-driven probabilities computed from 13 past papers (2078-2082) by mapping each real question to its syllabus unit. They indicate what has historically been likely, not guaranteed questions. Always study the full syllabus.