平衡的二叉搜索树问题

Balanced Binary Search Tree Questions

本文关键字:搜索树 问题 平衡      更新时间:2023-10-16

我是 c++ 的新手,我刚刚创建了一个平衡的二叉搜索树,我只是有几个问题。

1) What is the efficiency of inserting/looking up/ removing/ from an ideally balanced binary tree is big-O of?
2) How would I order A.go left, B. go right, C visit in pre-order, in-order and post-order traversal?
3) Last question is infinite recursion is one cause of an infinite loop?

提前致谢

1) The efficiency of inserting/looking up/ removing is  O(log2(n)) 
if you didn't understand that I would recommend googling it
2) Pre-Order : Visit, go left and visit until leaf is reached, then go up and right & visit. Then repeat going left and visiting.
   In order : Go to the left most child and visit, then go up and visit, then go right and visit. repeat from start.
   Post- Order: A (visit last) A->B->C
3) And recursion isn't a loop. 
I would recommend googling all these questions/ wiki has good information about binary     search tree