parent and child
The relationship between two directly connected tree nodes: the parent is the one nearer the root and the child the one below it.
In more detail
A binary tree node has up to two children. In an array-backed heap, the children of index i are at 2i + 1 and 2i + 2, and its parent is at (i - 1) // 2. Post-order traversal handles children before their parent.
Related terms
- tree — A hierarchy of nodes joined by edges, with one root at the top, no cycles, and exactly one path between any two nodes.
- binary heap — A complete binary tree stored in an array in which every parent is ordered before its children, so the smallest (or largest) item is always at the root.
- root — The single node at the top of a tree, the only one with no parent.
Taught in
- Binary Trees And Their Traversals — Algorithms & Data Structures for Working Engineers
- Binary Search Trees: Search, Insert And Delete — Algorithms & Data Structures for Working Engineers
- AVL Trees: Rotations That Keep The Guarantee — Algorithms & Data Structures for Working Engineers
- B-Trees: The Structure Behind Every Database Index — Algorithms & Data Structures for Working Engineers
- Heaps And Priority Queues — Algorithms & Data Structures for Working Engineers
- Minimum Spanning Trees: Kruskal And Prim — Algorithms & Data Structures for Working Engineers