Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Software Development
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming graphics hard drive hardware hdmi internet laptop lcd malware memory monitor motherboard network printer problem ram registry router slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
Need help with binary trees and binary search trees.

Reply  
Thread Tools
Daskill's Avatar
Member with 260 posts.
 
Join Date: Oct 2007
Experience: Intermediate
30-Nov-2008, 12:52 PM #1
Unhappy Need help with binary trees and binary search trees.
I've got to do some stuff with binary trees and binary search trees, but I'm having difficulty with it and was wondering if there might be some people here who could offer me help.

1) What's the difference between a binary tree and a binary search tree?

2) If I have a set of integers, say x = [5, 7, 12, 2, 4, 18, 9, 10, 1] and I have to put these into a binary tree, how do I decide where each integer goes, ie how do I decide what is the root, what are its children etc.

3) Same as above for a binary search tree. Are there any differences?

Thanks.
Mr Red's Avatar
Computer Specs
Member with 74 posts.
 
Join Date: Dec 2008
02-Dec-2008, 08:52 AM #2
if you use DEC2HEX() or DEC2BIN() in an adjacent column and then look for LEN() of result it should give clues - or at least help you do some text manipulation.

Not sure what is meant by root unless it is the MSB that is "1"
Daskill's Avatar
Member with 260 posts.
 
Join Date: Oct 2007
Experience: Intermediate
02-Dec-2008, 09:34 AM #3
I didn't understand any of that.

I've got to do this by hand, and I don't know what the rules are for putting a set of integers into a binary tree.

And, by root, I mean the root of the tree.
Mr Red's Avatar
Computer Specs
Member with 74 posts.
 
Join Date: Dec 2008
02-Dec-2008, 09:40 AM #4
I assumed you were using a spreadsheet. May not be a bad idea.


Still don't follow your root. Is the root of numbers 2 & 3 - 0/1 ie the LSB of a binary number - or does it have a specific meaning in the context of your problem.
Daskill's Avatar
Member with 260 posts.
 
Join Date: Oct 2007
Experience: Intermediate
02-Dec-2008, 10:13 AM #5
I don't know what you mean. I've just got a set of numbers for which I have to draw a binary tree. What I don't know is what order I'm supposed to put them into the tree.
Mr Red's Avatar
Computer Specs
Member with 74 posts.
 
Join Date: Dec 2008
02-Dec-2008, 10:37 AM #6
http://en.wikipedia.org/wiki/Binary_tree should move you on, not quite what I imgined. But read down to
Methods for storing binary trees


and look at the picture
Daskill's Avatar
Member with 260 posts.
 
Join Date: Oct 2007
Experience: Intermediate
02-Dec-2008, 10:46 AM #7
I think that's for storing a binary tree in an array. I want to know how to arrange a set of integers into a binary tree.
Mr Red's Avatar
Computer Specs
Member with 74 posts.
 
Join Date: Dec 2008
08-Dec-2008, 02:18 PM #8
I would think if you are writing it on paper start with a grid (or notional geographic grid) and place the numbers as if it was an array.

The branches then would run through numbers that are not present even though their position is implied. Missing numbers would just have the line through to the next level/branch.

You can then economise the whitespace as a second iteration.

The link shows your tree at the top right hand area.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:13 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.