Welcome! Log In Create A New Profile

Advanced

Assignment 4 Q 3

Posted by esckay 
Announcements Last Post
Announcement : Programming Students at UNISA School of Computing 06/19/2019 02:01PM
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Assignment 4 Q 3
July 03, 2006 05:18PM
Hi,

Can anyone help with this question ?

I could do the recursive function (leavesCount), but I can't figure out what to do with the iterative version of the function. Anybody ?

Cheers,
Esckay
Re: Assignment 4 Q 3
July 05, 2006 11:20PM
I got an iterative version by doing something similar to the nonrecursive preorder traversal (using a stack) which is essentially what needs to be done: each node in the tree must be visited and keep a count of those that have neither a left nor right link.
Re: Assignment 4 Q 3
July 08, 2006 04:17PM
Hi Steven,

Thanks for the info. I'm still struggling though. Are you using the STL stack (thats the one I'm using) and if you are, what class type are you making the stack ? I am making the stack type nodeType<elemType> , but U am stuggling to push the pointer onto the stack, or am I going about this the wrong way ?

Cheers,
Esckay
Re: Assignment 4 Q 3
July 09, 2006 08:21PM
Hi Steven,

Never mind, I eventually came right.

Thanks,
Esckay
Sorry, only registered users may post in this forum.

Click here to login