Data Structures · ডেটা স্ট্রাকচার


Trees: BST, AVL and Heapsট্রি: BST, AVL এবং Heap

1. Introduction

A tree is a non-linear, hierarchical data structure made of nodes connected by edges, with no cycles. Unlike arrays or linked lists (which are linear), a tree lets us model parent-child relationships - file systems, organization charts, XML/HTML, and the internal machinery of databases all use trees.

For competitive government IT exams (BCS, Bank IT officer, various IT posts), three tree families appear again and again:

  • Binary Search Tree (BST) - keeps data ordered so search/insert/delete run fast on average.
  • AVL tree - a self-balancing BST that guarantees O(log n) even in the worst case.
  • Heap - a complete binary tree used to build priority queues and Heapsort.

Examiners love these because a single tree lets them test terminology (height, degree, leaf), traversals (inorder/preorder/postorder), rotations, and time complexity all at once. Master this lesson and you can answer almost any tree question by hand.

2. Learning objectives

After studying this lesson you will be able to:

  • Define every core tree term: node, root, leaf, edge, parent, child, degree, height, depth, level, subtree.
  • Distinguish full, complete, perfect, and balanced binary trees.
  • Perform BST search, insertion and deletion (all three deletion cases) by hand.
  • Compute the three depth-first traversals (inorder, preorder, postorder) and level-order.
  • Explain why a plain BST can degrade to O(n) and how AVL fixes it.
  • Compute balance factors and apply the four AVL rotations (LL, RR, LR, RL).
  • Represent a heap in an array, and run insert (sift-up) and extract (sift-down).
  • Build a heap in O(n) and trace Heapsort.
  • Choose the right structure and state the correct time complexity for exams.

Continue this lesson free: create an account

You have read the opening of this lesson. The full lesson (3,705 words, in English and Bangla) has worked examples, practice questions with answers and exam tips. A free account opens it and saves your progress.পুরো পাঠটি পড়তে বিনামূল্যে অ্যাকাউন্ট খুলুন।

More on this subject: Data Structures guide: syllabus by chapter and past questions

© 2026 ARBS Academy (Aether Brains). Questions' explanations, model answers and lessons are our original work; copying or republishing is not allowed.

© ২০২৬ এআরবিএস একাডেমি (Aether Brains)। প্রশ্নের ব্যাখ্যা, মডেল উত্তর ও লেসন আমাদের নিজস্ব কাজ; কপি বা পুনঃপ্রকাশ করা নিষেধ।