---
id:"kb-2026-00138"
title:"Tree Data Structure"
schema_type:"TechArticle"
category:"computer-science"
language:"en"
confidence:"high"
last_verified:"2026-05-22"
generation_method: "human_only"
ai_models:["claude-opus"]
derived_from_human_seed:true


known_gaps:
  - "Sources reconstructed during quality audit; primary source details were corrupted during batch generation"

completeness: 0.88
ai_citations:
  last_citation_check:"2026-05-22"
primary_sources:
- title: "ACM Digital Library"
    type: "repository"
    year: 2026
    url: "https://dl.acm.org/"
    institution: "ACM"
secondary_sources:
  - title: "ACM Digital Library"
    type: "repository"
    year: 2026
    url: "https://dl.acm.org/"
    institution: "ACM"
---

## TL;DR

A tree is a hierarchical data structure with a root node and child subtrees. Each node (except root) has exactly one parent. Specialized trees: binary trees (max 2 children), N-ary trees, tries (prefix trees), segment trees (range queries), Fenwick trees (prefix sums).

## Core Explanation

Binary tree properties: max nodes at level l = 2^l, max total nodes = 2^(h+1)-1. Full binary tree: every node has 0 or 2 children. Complete binary tree: all levels filled except possibly last. Perfect binary tree: all levels completely filled. Tries store strings character-by-character for O(k) lookup (k = key length).

## Further Reading

- [Algorithms (4th Edition)](undefined)
