Skip to content
Shafin Chowdhury
Topic Hub Trees & Graphs

Trees, BSTs & Graph Traversal in C++

Trees and graphs are where data structures stop being linear. This series starts with tree vocabulary and the four traversals, adds the binary search tree's ordering rule, drills the interview and university exam questions built on both, and ends with depth-first and breadth-first search on general graphs. Every article uses the same example structures, tested C++ code and step-by-step diagrams.

Curated Learning Path

Follow this progressive roadmap from foundational mechanics to advanced implementations.

1
Beginner 19 min read

Trees, Binary Trees & Traversals

Terminology, full vs complete vs perfect trees, building a tree, and inorder, preorder, postorder and level order.

Start Step 1
2
Beginner 13 min read

Binary Search Tree (BST)

The BST property, search, insertion, the three deletion cases, successor, validation and balance.

Start Step 2
3
Intermediate 11 min read

Tree Interview Questions

Height, diameter, LCA, symmetric and balanced checks, building from traversals, serialization.

Start Step 3
4
Intermediate 12 min read

BST Interview Questions

Kth smallest, LCA in a BST, floor and ceil, recover a BST, BST to linked list, largest BST subtree.

Start Step 4
5
Beginner to Intermediate 20 min read

Tree Questions for University Exams

Written, lab and viva practice for CSE students in Bangladesh: traversals, reconstruction, iterative algorithms.

Start Step 5
6
Beginner to Intermediate 16 min read

BST Questions for University Exams

BST construction from a sequence, deletion traces, pseudocode, worst case and viva answers.

Start Step 6
7
Beginner 13 min read

What Are DFS and BFS?

A visual beginner's guide to graphs, stacks, queues and the two basic graph traversals.

Start Step 7
8
Intermediate 15 min read

DFS vs BFS

Side-by-side comparison with shortest paths, cycle detection, connected components and interview questions.

Start Step 8

Articles by Category

Browse all technical guides and references organized by subject area.

1. Trees & Binary Search Trees

Core concepts and C++ implementations.

2. Interview Preparation

The most common coding interview questions with tested C++.

3. University Exam Preparation (Bangladesh)

Written, lab and viva questions with model answers.

4. Graph Traversal: DFS & BFS

From first principles to a complete comparison.

Related Topic Hubs

Broaden your knowledge across interconnected computer science domains.