Programming

Data Structures for C-CAT: Operations, Complexity and Revision

Free Learning preparation advice: The detailed examples and study order below are editorial suggestions, not an official subtopic list or prediction of question frequency. The official indicative syllabus does not assign subject-wise question counts or difficulty percentages.

Data Structures is an official Section B subject. The examples below are our study checklist, not an exhaustive official subtopic syllabus. Complexity statements assume the standard implementations described; state representation and algorithm assumptions when comparing alternatives.

Time Complexity — The Foundation

Understanding time complexity is essential because many CCAT questions ask you to identify the complexity of an algorithm or compare algorithms.

Data Structures — CCAT Topic Map
Sorting Bubble, Selection, Insertion, Merge, Quick — know time complexities
Searching Linear vs Binary search — when to use which
Linked Lists Singly, Doubly, Circular — insertion, deletion, reversal
Stack & Queue LIFO vs FIFO, infix/postfix, BFS using queue
Trees BST, traversals (in/pre/post), height, balanced trees
Graphs BFS, DFS, adjacency matrix/list representations
ComplexityNameExample
O(1)ConstantArray access by index
O(log n)LogarithmicBinary Search
O(n)LinearLinear Search
O(n log n)LinearithmicMerge Sort, Quick Sort (avg)
O(n²)QuadraticBubble Sort, Selection Sort
CCAT Tip: Memorize best, average, and worst-case complexity for all sorting algorithms. Use these comparisons as revision exercises, not predicted question frequencies.

Sorting Algorithms

Sorting is a useful editorial revision topic. Know how each algorithm works and its complexity.

AlgorithmBestAverageWorstStable?
Selection SortO(n²)O(n²)O(n²)No
Bubble Sort (early-exit version)O(n)O(n²)O(n²)Yes
Insertion SortO(n)O(n²)O(n²)Yes
Merge SortO(n log n)O(n log n)O(n log n)Yes
Quick SortO(n log n)O(n log n)O(n²)No

Key Points to Remember

  • Merge Sort always gives O(n log n) but requires extra space O(n)
  • Quick Sort averages O(n log n); poor pivot choices can cause O(n²), including on sorted input for some implementations
  • Bubble Sort with optimization (flag-based) has best case O(n)
  • Know the step-by-step process for each algorithm

Searching Algorithms

Linear Search

  • Time: O(n) — checks each element sequentially
  • Works on unsorted arrays

Binary Search

  • Time: O(log n) — divides the search space in half each time
  • Requires a sorted array
  • Know iterative and recursive implementations

Linked Lists

Compare representations, operations and their complexity assumptions.

Types of Linked Lists

  • Singly Linear: Each node points to the next, last node points to NULL
  • Doubly Linear: Each node has previous and next pointers
  • Singly Circular: Last node points back to the first node
  • Doubly Circular: Doubly linked + circular (last node's next = first, first node's prev = last)

Important Operations

OperationArray (dynamic for append)Linked List
Access by indexO(1)O(n)
Insert at beginningO(n)O(1)
Insert at endO(1) amortizedO(n) or O(1) with tail
Delete by valueO(n)O(n)
SearchO(n)O(n)

Stack & Queue

Stack (LIFO)

  • Linked-stack push, pop and peek/top are O(1); a dynamic-array push can require resizing
  • Applications: Expression evaluation, parenthesis matching, recursion, undo operations
  • Know infix to postfix conversion

Queue (FIFO)

  • A standard linked or circular FIFO queue supports enqueue, dequeue, front and rear in O(1); priority-queue complexities depend on implementation
  • Types: Simple Queue, Circular Queue, Priority Queue, Deque
  • Applications: CPU scheduling, BFS traversal, printer spooling

Trees & Traversals

Tree Terminology

Root, Parent, Child, Leaf, Sibling, Height, Depth, Level, Degree — know each definition clearly.

Binary Tree Types

  • Full Binary Tree: Every node has 0 or 2 children
  • Complete Binary Tree: All levels filled except possibly the last (filled left to right)
  • Perfect Binary Tree: All internal nodes have 2 children, all leaves at same level
  • Binary Search Tree (BST): All keys in the left subtree precede the node key; all keys in the right subtree follow it, assuming distinct keys

Tree Traversals — Very Important

  • In-order (LNR): Left → Node → Right — gives sorted order for BST
  • Pre-order (NLR): Node → Left → Right — used for copying trees
  • Post-order (LRN): Left → Right → Node — used for deleting trees
Practice Tip: Given a tree, practice writing all three traversals. Use tree traversals to check that you understand node order. Practice on Free Learning's MCQ section.

Graphs

For an introductory graph checklist, review these concepts; this is not a verified limit on official coverage:

  • Directed vs Undirected graphs
  • Weighted vs Unweighted graphs
  • Adjacency Matrix vs Adjacency List representation
  • BFS (Breadth-First Search) — uses Queue
  • DFS (Depth-First Search) — uses Stack
  • Spanning Tree — minimum spanning tree concepts

Use the verified pattern and syllabus guide to check coverage and the mock-test page for timed practice. The free Quick Test is separate from paid full mocks. Subject-wise notes and chapter practice and previous year question papers are paid products with 90-day access. Free Learning questions are not official C-DAC papers.