On Finding the Height of a Binary Search Tree
Author(s) -
Mark Allen Weiss
Publication year - 1993
Publication title -
the computer journal
Language(s) - English
Resource type - Journals
SCImago Journal Rank - 0.319
H-Index - 64
eISSN - 1460-2067
pISSN - 0010-4620
DOI - 10.1093/comjnl/36.3.280
Subject(s) - tree traversal , preorder , binary search tree , binary tree , running time , binary number , computer science , tree (set theory) , algorithm , time complexity , computation , exponential function , mathematics , discrete mathematics , combinatorics , arithmetic , mathematical analysis
The preorder, inorder and postorder traversals of binary trees are standard topics in Data Structures courses. A common example (or test question) which uses postorder traversal is finding the height of a randomly formed binary search tree (to verify experimentally that it is indeed O(log n)). The natural postorder implementation gives a linear algorithm, but frequently students manage, sometimes unintentionally, to add a third recursive call to the computation, resulting in an apparently drastic increase in running time. It is obvious that the worst case running time increases from linear to exponential, but the results on the average case running time are not as immediate
Accelerating Research
Robert Robinson Avenue,
Oxford Science Park, Oxford
OX4 4GP, United Kingdom
Address
John Eccles HouseRobert Robinson Avenue,
Oxford Science Park, Oxford
OX4 4GP, United Kingdom