473,399 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

how to traverse a tree

I need to traverse a binary search tree and be able to give an output of how many leaf nodes there are, and how many leafs have one child and how many leafs have two children. Im not asking for a code just the general idea of how to process the information. Thank you
Aug 29 '07 #1
1 1865
Ganon11
3,652 Expert 2GB
Well, how could you possibly do this?

One thing I remember about working with trees is that most of this type of work was done with recursion. Have you worked with recursive functions before? If so, this should be easy!
Aug 29 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python suppose you want to walk into a directory, say, to apply a string replacement to all html files. The os.path.walk() rises for the occasion. © import os ©...
1
by: Raed Sawalha | last post by:
I have a TreeView with 4 levels I need to implement Next and Back capability , my problem in how to traverse the tree to achieve this task.
2
by: john | last post by:
I posted this question to comp.lang.javascript but didn't get a response, so I'll try here. I am using ASP.NET and I have a datagrid. One of the columns in my grid is all checkboxes. When the...
3
by: Shaurya Vardhan | last post by:
Hi, How to Traverse all the nodes of a Tree View Control using VB.Net? Thanx in Advance.
2
by: Namenick | last post by:
Hello, I am completely new to Python, would u please tell me something about Python compiler traversing techniques ? or please direct me to some document if available on the net for reference ? ...
0
by: rag84dec | last post by:
void TreeClass::PublishOptions() { HTREEITEM Item=GetRootItem(); string s=GetItemText(Item); Item=GetNextItem(Item,TVGN_CHILD); s=GetItemText(Item); while(Item) { ...
0
by: flavourofbru | last post by:
Hi, I am converting the XML documents into tree structure using JDOM. Now I would like to parse the tree and store the entire tree structure and its information in the database(Access or Oracle)...
1
by: kishore84 | last post by:
I want to traverse a tree having more than one children. How to do that. please provide some code snippet or link. Thanks
6
by: gskbond | last post by:
Following is my logic to traverse level by level an mway search tree.... (Yeah I finally used templates to implement a queue... :) ) void mWayTree:: TraverseLevelOrder(Node *root,int lvl) {...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.