## Re:Problem with recursion and binary search trees

##### Quote

In article <4rfdlc$...@canopus.cc.umanitoba.ca>, umwon...@cc.umanitoba.ca (Edwin Wong) writes:

> I'm having a problem with recursion. I'm trying to create a function that will

> return the number of interior nodes in a binary search tree (bst) not including

> the root node. The function below returns the number of interior nodes

> including the root node but I can't figure out how to modify it so that it won't

> include the root node. Can anybody help me? I would appreciate it a lot.

> [...]

Just subtract 1 from the result if the root node is <> nil...

Like this :

result=interior(mybst);

if result>0 then Dec(result);

The only problem is that you have to do this externally, but you can always

make another function that contains just the code above.

--

Vladan Bato

i3100...@univ.trieste.it

http://www.geocities.com/SiliconValley/8682/