Skip to content
Azhimathi Mayam logoDSA Study HubPCCST303 · KTU · S3
Module 3 · 11 hours

Trees and Graphs

Official syllabus text (word for word)

Trees and Graphs — Trees: Representation Of Trees; Binary Trees - Types and Properties, Binary Tree Representation, Tree Operations, Tree Traversals; Expression Trees; Binary Search Trees - Binary Search Tree Operations; Binary Heaps - Binary Heap Operations, Priority Queue. Graphs: Definitions; Representation of Graphs; Depth First Search and Breadth First Search; Applications of Graphs - Single Source All Destination.

  1. 1
    Trees: terminology and representation

    Tree vocabulary (root, leaf, degree, level, height…) and three ways to store a general tree.

    lesson live
  2. 2
    Binary trees: types and properties

    At most two children per node: full, complete, skewed trees and the formulas that come up every year.

    lesson liveasked 1×
  3. 3
    Binary tree representation

    Store a binary tree in an array (children at 2i and 2i + 1) or with linked nodes — and convert between drawing and array.

    lesson livevisualizerC codeasked 2×
  4. 4
    Tree operations and traversals

    Inorder, preorder, postorder and level order — four ways to visit every node, with recursive algorithms.

    lesson livevisualizerC codeasked 2×
  5. 5
    Expression trees

    Operators inside, operands at the leaves: build the tree for any expression and read off prefix, infix and postfix.

    lesson livevisualizerC codeasked 2×
  6. 6
    Binary search trees

    Left smaller, right bigger: search, insert and the three delete cases — with the KTU questions worked out.

    lesson livevisualizerC codeasked 3×
  7. 7
    Binary heaps and priority queues

    A complete binary tree with the biggest (or smallest) key on top — the engine behind priority queues and heap sort.

    lesson livevisualizerC codeasked 4×
  8. 8
    Graph definitions

    Vertices, edges and the vocabulary — directed, undirected, degree, path, cycle, connected, weighted.

    lesson live
  9. 9
    Graph representation

    Adjacency matrix vs adjacency list — how to store a graph and when to choose which.

    lesson livevisualizerC codeasked 1×
  10. 10
    Depth-first and breadth-first search

    Explore a graph level by level with a queue (BFS) or go as deep as possible with a stack or recursion (DFS).

    lesson livevisualizerC codeasked 3×
  11. 11
    Single source all destinations (Dijkstra)

    Dijkstra's algorithm: the shortest distance from one source to every vertex, with a step-by-step table.

    lesson livevisualizerC codeasked 2×