Analysis
- Idea by using recursion.
- For converting a sorted list to binary search tree, firstly find the middle item in the list.
- Then recursively convert the first half list and second half list to two binary search tree separately.
- Finally create a new node with value of the middle item and each child pointer pointing to the two binary search tree built recursively before.
No comments:
Post a Comment
Enter you comment