NSCT Data Structures & Algorithms Revision Notes

By the NSCT Exam Editorial Team · Updated 2026-11-24 · Facts checked against official sources on 2026-11-24

These notes condense all 12 official Data Structures & Algorithms topics into the complexities, traces, formulas and traps you need for fast recall. DSA carries 10% of the NSCT, according to HEC's Areas of Competencies. In 2026 candidates averaged 40.2% accuracy in it, one of the four weakest areas, per the HEC NSCT report and APP.

How to use them: read a topic, then trace its MCQs on paper through the link under it, and log each miss in an error log with the step where you went wrong. HEC's report put accuracy at 49.5% for Understanding, 45.1% for Application and 44.8% for Analysis questions. In DSA, application means executing an algorithm (a traversal, a sort pass, a probe sequence), so practise by hand.

Foundations of Data Structure and Algorithms

Notation Meaning
O(g) Upper bound (3n + 5 is O(n) and also O(n²))
Ω(g) Lower bound
Θ(g) Tight bound: both O and Ω

Trap: equating worst case with Big-O and best case with Omega. Any case can use any notation. Practise: Foundations MCQs.

Linear Data Structures

Operation Array Singly linked list (head only)
Access i-th O(1) O(n)
Insert at front O(n) O(1)
Insert at end O(1) amortised O(n), O(1) with tail pointer

Trap: assuming linked-list insertion is always O(1). It is O(1) only once you are at the position. Practise: Linear Data Structures MCQs and stack and queue applications.

Non-Linear Data Structures

Trap: assuming BST search is always O(log n). An unbalanced BST is O(n). Practise: Non-Linear Data Structures MCQs.

Searching Algorithms

Trap: binary search on a linked list. Reaching the middle costs O(n), so it is no faster than linear. Practise: Searching MCQs.

Sorting Algorithms

Algorithm Best Worst Extra space Stable
Bubble (flag) O(n) O(n²) O(1) Yes
Selection O(n²) O(n²) O(1) No
Insertion O(n) O(n²) O(1) Yes
Merge O(n log n) O(n log n) O(n) Yes
Quick O(n log n) O(n²) O(log n) average No
Heap O(n log n) O(n log n) O(1) No

Trap: calling heap sort stable because it is always O(n log n). Practise: Sorting MCQs and sorting comparison.

Hashing

Trap: forgetting to wrap around from slot m − 1 to slot 0 when probing. Practise: Hashing MCQs.

Tree Algorithms

Traversal Order
Preorder node, left, right
Inorder left, node, right (sorted for a BST)
Postorder left, right, node
Level order by depth, using a queue

Trap: classifying an AVL case by the unbalanced node alone instead of where the new key went. Practise: Tree Algorithms MCQs and tree traversals.

Graph Algorithms

Algorithm Problem Negative edges? Time
BFS Shortest paths, unweighted n/a O(V + E)
Dijkstra Single source No O((V + E) log V)
Bellman-Ford Single source Yes O(VE)
Floyd-Warshall All pairs Yes, no negative cycles O(V³)

Trap: using Dijkstra with a negative edge. Practise: Graph Algorithms MCQs and graph traversal traces.

Algorithm Design Techniques

Technique Examples
Divide and conquer Merge sort, quicksort, binary search
Greedy Huffman, Kruskal, Prim, Dijkstra, activity selection
Dynamic programming 0/1 knapsack, LCS, edit distance, Floyd-Warshall
Backtracking N-Queens, Sudoku, subset sum

Trap: calling Dijkstra or Prim dynamic programming. Most textbooks, including CLRS, class them as greedy. Practise: Design Techniques MCQs and dynamic programming.

Advanced Data Structures

Trap: treating a prefix path as a stored word when its end-of-word flag is false. Practise: Advanced Data Structures MCQs.

String Algorithms

Algorithm Worst-case matching Key idea
Naive O((n − m + 1) m) Try every shift
KMP O(n + m) total Prefix function; text pointer never moves back
Rabin-Karp O((n − m + 1) m), expected O(n + m) Rolling hash, then verify

Trap: assuming a hash match is a real match. Rabin-Karp must verify characters. Practise: String Algorithms MCQs.

Complexity & Optimization

Recurrence Solution
T(n) = T(n/2) + 1 Θ(log n)
T(n) = 2T(n/2) + n Θ(n log n)
T(n) = T(n − 1) + n Θ(n²)
T(n) = 2T(n − 1) + 1 Θ(2ⁿ)

Trap: applying the master theorem to T(n − 1) recurrences. Unroll them instead. Practise: Complexity MCQs and Big-O practice.

Most-tested comparisons

Pair Key difference
Stack vs queue LIFO vs FIFO
Array vs linked list O(1) access vs O(1) insert at a known position
BFS vs DFS Queue, shortest unweighted paths vs stack or recursion
Merge vs quick sort Stable, O(n) space, always n log n vs in place, O(n²) worst
Dijkstra vs Bellman-Ford No negative edges, faster vs handles negatives
Prim vs Kruskal One growing tree vs merging forest
Greedy vs DP Local choice, never undone vs stored subproblem answers
Heap vs BST Parent vs children order vs whole-subtree order
Chaining vs open addressing Lists per slot vs probing inside the table

Last-48-hours checklist

  1. Recite the sorting table, including stability.
  2. Write preorder, inorder and postorder for one seven-node tree.
  3. Trace BFS and DFS on a small graph with alphabetical neighbour order.
  4. Run Dijkstra on a five-vertex graph.
  5. Build an MST with Kruskal and with Prim; confirm the same total.
  6. Insert five keys with linear probing, including a wrap-around.
  7. Solve three master-theorem recurrences.
  8. Count iterations for nested loops and a doubling loop.
  9. Do one AVL insertion that needs a double rotation.
  10. Compute a KMP prefix function by hand.
  11. Evaluate one postfix expression with a stack.
  12. Name which design technique fits knapsack, Huffman and N-Queens.
  13. Redo your error log, then one timed set in subject-wise mock tests.

Keep the DSA cheat sheet for its complexity table, and use the DSA MCQ hub for the full topic list.

FAQs

Why do students score low in DSA?

The 2026 average was 40.2%, per HEC's report. HEC does not break this down by topic, but DSA questions often ask you to execute an algorithm step by step or work out a complexity, not just recall a definition. Tracing on paper and checking each step against a worked answer is the fix.

Which DSA topics should I revise first?

Start with Big-O and loop counting, because complexity questions appear across every topic. Then sorting, trees and graphs, which carry the most hand-tracing. Leave advanced structures and string algorithms until the core is solid.

Do I need to write code for DSA questions?

Mostly you read and trace rather than write. Expect pseudocode or short code fragments where you predict output, count iterations or spot a bug. If you can dry-run a loop with a trace table and know the standard algorithms step by step, you are ready.

How many hours should I give DSA?

Our recommendation is about 6 hours out of a 60-hour subject plan, in line with its 10% weightage, with extra time if a diagnostic shows DSA is weak for you. The 8-week plan and 30-day plan both schedule it.

What should I do in the last week?

Stop learning new structures. Work through the checklist above, redo your error log and take timed sets. The 7-day plan gives DSA a dedicated block alongside the other weak areas.

Next step

Start with Big-O practice, then test every area together in an NSCT mock test.