Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

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 Dev Shed Forums Sponsor:
  #1  
Old March 12th, 2004, 07:57 AM
ramu_ak ramu_ak is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 ramu_ak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
balanced binary trees

hi all
I have a situation in which i maintain a balanced binary tree but the scenario is that I get numbers from 1 to n sequentially as 1,2,3...n as input one by one. So intially i have 1 in binary tree and then 1 and 2 in the tree and so on.. now the problem is that can i find a mapping between the number to be inserterd into the tree and the node in tree at which their might be a possible left rotation.. In my scenario only a single left rotation might be needed when an insertion is performed..

Thanx for any help in advance
bye

Reply With Quote
  #2  
Old March 14th, 2004, 03:55 PM
DaWei_M's Avatar
DaWei_M DaWei_M is offline
Permanently Banned
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Jan 2004
Location: Central New York. Texan via Arizona, out of his element!
Posts: 7,351 DaWei_M User rank is Sergeant (500 - 2000 Reputation Level)DaWei_M User rank is Sergeant (500 - 2000 Reputation Level)DaWei_M User rank is Sergeant (500 - 2000 Reputation Level)DaWei_M User rank is Sergeant (500 - 2000 Reputation Level)DaWei_M User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 19 h 39 m 7 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
If your data come in sorted, why are you even putting them in a binary tree?

Reply With Quote
  #3  
Old March 20th, 2004, 01:36 PM
Coder4Jesus's Avatar
Coder4Jesus Coder4Jesus is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 28 Coder4Jesus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
AVL Tree

Quote:
Originally Posted by ramu_ak
hi all
I have a situation in which i maintain a balanced binary tree but the scenario is that I get numbers from 1 to n sequentially as 1,2,3...n as input one by one. So intially i have 1 in binary tree and then 1 and 2 in the tree and so on.. now the problem is that can i find a mapping between the number to be inserterd into the tree and the node in tree at which their might be a possible left rotation.. In my scenario only a single left rotation might be needed when an insertion is performed..

Thanx for any help in advance
bye


Have you considered implementing an AVL Binary tree?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > balanced binary trees


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 6 hosted by Hostway
Stay green...Green IT