Wed, 18 Jun 1902 08:00:00 GMT
Binary Search Tree help needed
In article <384b4606.10508...@news.compusmart.ab.ca>, QuoteAcidhurl <acidh...@NOSPAMhotmail.com> wrote: >Here is my problem: >Write a function to determine and return the height of a binary search >tree. The height of the tree T is defined recursively in terms of the >levels of its nodes: >if T is empty. then Height (T) = 0 >if T isnt empty then > Height(T) = 1 + max(Height(L) , Height(R)) >where L and R are the right and left children of T
What is your question? Do you really expect others to do your home work? The problem is very simple. The coding is basically directly the same as the definition above. Here is a skeleton: Function height(p:pnode):integer; Begin if <tree is empty> then Height:=nil else begin <get the heights of the subtrees recursively> <choose larger one> <return the value +1 > End; End; Osmo
