SunQuest
 
           ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old March 14th, 2006, 04:13 AM
subhashparayil subhashparayil is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 9 subhashparayil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 58 m 53 sec
Reputation Power: 0
How Implement Binary Tree Nodes Counting?

Dear Friends,

I need to find the total number of nodes in a binary tree structure, Also need the the leftside and right side separately.

Please help us.

Also Please check the attachments. Attachment contains database structure and Binary Tree Structure.

with regards
Subhash
Attached Images
File Type: gif binarytree.gif (6.4 KB, 45 views)
File Type: gif database.gif (4.6 KB, 42 views)

Reply With Quote
  #2  
Old March 15th, 2006, 02:44 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,178 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 94009 Folding Title: Advanced FolderFolding Points: 94009 Folding Title: Advanced FolderFolding Points: 94009 Folding Title: Advanced FolderFolding Points: 94009 Folding Title: Advanced FolderFolding Points: 94009 Folding Title: Advanced Folder
Time spent in forums: 3 Months 2 Weeks 2 Days 6 h 54 m 14 sec
Reputation Power: 683
do you need to do this with queries only?
do you just want the number of nodes?
then there queries should work?
Code:
'--> total number of nodes
select count(*) - 1 from nodeTable

'--> total number of left nodes
select count(*) from nodeTable where leftid is not null

'--> total number of right nodes
select count(*) from nodeTable where rightid is not null

hope this helps
__________________
Look! Its a ShemZilla



Reply With Quote
  #3  
Old March 21st, 2006, 12:42 AM
subhashparayil subhashparayil is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 9 subhashparayil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 58 m 53 sec
Reputation Power: 0
Hi friend,

I am using ASP for implementing this program, Yes i need find the total number of sub nodes( left and right ) in a particular node. I attached the database structure and pictorial representation of nodes in database. Please check it.

I need the sql query that implementing the program.

1. Find the total number of subnodes of a particular node.
2. Find the total number of left handside nodes of a particular node.
2. Find the total number of right handside nodes of a particular node.

Please give me the idea.

warm regards
Subhash

Reply With Quote
  #4  
Old May 13th, 2008, 04:52 AM
Saif Sarwer Saif Sarwer is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 18 Saif Sarwer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 28 m 16 sec
Reputation Power: 0
Hi Subhash,

Am also facing this problem...
Hope you can help me....

I have to implement MLM using sql-2000..
Please tell me the query of how to get the sub nodes of any given nodes....if not query then tell me in any other programmin language....
I am working on C#/ASP.NET.

Quote:
Originally Posted by subhashparayil
Hi friend,

I am using ASP for implementing this program, Yes i need find the total number of sub nodes( left and right ) in a particular node. I attached the database structure and pictorial representation of nodes in database. Please check it.

I need the sql query that implementing the program.

1. Find the total number of subnodes of a particular node.
2. Find the total number of left handside nodes of a particular node.
2. Find the total number of right handside nodes of a particular node.

Please give me the idea.

warm regards
Subhash

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > How Implement Binary Tree Nodes Counting?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway