Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 359 Bytes

README.md

File metadata and controls

23 lines (18 loc) · 359 Bytes

Data Structures

Binary Tree

Binary Tree as an Array

Binary trees may be represented as an array, for example:

A /
B C /\ /
D E F G

Can be stored as array:

|A|B|C|D|E|F|G|

The relationship between elements is as follows: For node at index i: Left node at 2*i Right node at 2*i+1 Parent at i/2