Back to course home
0% completed
Vote For New Content
I understand the space is O(n), with the use of the queue and list were returnin...
Salah Osman
Jan 26, 2023
I understand the space is O(n), with the use of the queue and list were returning. Could someone clarify this sentence
"Since we can have a maximum of N/2 nodes at any level (this could happen only at the lowest level)
0
0
Comments
Comments
Design Gurus3 years ago
Imagine a complete binary tree. First level will have 1 node, second level will have 2 nodes, third level will have 4 nodes, forth will have 8 nodes. So the last level has 8 nodes which is half of the total nodes (15). This is what N/2 refers to.
On this page