Question list

Helen Hung / 2025-01-25 / 原文

  1. How do we transfer an array to a binary tree?
    we fill with Null if we do not need it when it is necessary.
graph TB A((12)) B((4)) C((15)) D((Null)) E((6)) F((10)) G((Null)) A-->B A-->C B-->D B-->E C-->F C-->G

The array to describe the binary tree above is [12, 4, 15, Null, 6, 10, Null] and the last Null can be deleted as it is not necessary.