cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Binary Tree length
Binary Tree length
Nov 7, 2010 at 10:36pm UTC
nkmarcus
(3)
Instead of counting the nodes in a binary tree each time to get the length of the tree, Can i just have a length private Data that i can increment or decrement each time i insert or delete nodes respectively?
Nov 7, 2010 at 11:43pm UTC
ne555
(10692)
How many times are you going to ask for the size?
I mean maintain that variable will be more costly than
one call
to the function.
Thinking on list. You don't have a size variable because of the splice function. Does your tree implement something similar?
Last edited on
Nov 7, 2010 at 11:44pm UTC
Topic archived. No new replies allowed.