Implement a binary tree

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

Hi all,

I have a question here regarding implementing Binary Tree.
I understand that Binary Tree can be implemented in one of
the following methods:

1)using nodes with pointers to two children.
2)using an array where children of node with index n are
at indices 2n and 2n+1.

Which of the above methods is more efficient and why is it
so?

Thank you very much in advance.


Sean
 
Sean said:
Hi all,

I have a question here regarding implementing Binary Tree.
I understand that Binary Tree can be implemented in one of
the following methods:

1)using nodes with pointers to two children.
2)using an array where children of node with index n are
at indices 2n and 2n+1.

Which of the above methods is more efficient and why is it
so?

"Introduction to Algorithms", by Cormen, Leiserson and Rivest is your
friend. Order a copy from Amazon today.

http://www.amazon.com/exec/obidos/tg/detail/-/0262031418/qid=1092319495

-cd
 
Sean said:
Hi all,

I have a question here regarding implementing Binary Tree.
I understand that Binary Tree can be implemented in one of
the following methods:

1)using nodes with pointers to two children.
2)using an array where children of node with index n are
at indices 2n and 2n+1.

Which of the above methods is more efficient and why is it
so?

Thank you very much in advance.


Sean

Here's an alternate source for this excellent book.

http://www.bookpool.com/.x/mkx6f7ju...+to+Algorithms,+Second+Edition&Go.x=17&Go.y=7
 
Back
Top