I think i am gonna need some help... feeling retarded :\

pen^2

Banned
Apr 1, 2000
2,845
0
0
how do you you find the height of a BST Tree? i remember doing this in the APCS 2 years ago, all play and no work made a fool :p
 

MrCodeDude

Lifer
Jun 23, 2001
13,674
1
76
Uhh, I didn't understand anything you wrote, so I'm stupider than you :) You should be proud.
-- mrcodedude
 

pen^2

Banned
Apr 1, 2000
2,845
0
0
oops, repetitive double redundancy in da house. BST stands for Binary Search Tree, shouldnt have said BST Tree :p
 

ThisIsMatt

Banned
Aug 4, 2000
11,820
1
0
BST, binary search tree. It a binary tree (each node has only two children) with the condition that the all descendents of a node that are smaller than the parent node fall to the left and all larger to the right...

[deleted]
Edit: Ah yes, it's 2:25AM and I'm talking out my arse again, good night :p

 

br0wn

Senior member
Jun 22, 2000
572
0
0
its not 2^k + 1

a BALANCED BST has height = log (n) + 1 where n is the number
of nodes.
 

br0wn

Senior member
Jun 22, 2000
572
0
0
its a searching technique...

You can search in log (n) ....

Suppose you have a list of 10 numbers (sorted) as follows:
3 4 10 12 18 19 20 31 34 50

In order to search a number, you don't have to compare
10 numbers to find it. In average, for a balance BST you can
search using 4 (approximately log (10)) comparisons for any number.

 

EvanFerguson

Banned
May 14, 2001
956
0
0
I used to know.........uhhhh, 1, 2, 4, 8, 16.........so like uhhh, total # of nodes times something or subtract this or divide that.......


powers of 2, prolly logarithmic or something
 

Elledan

Banned
Jul 24, 2000
8,880
0
0
Hmm.. sounds like a really useful thing. I might need to read some more on it before I understand it, but it sure sounds interesting. Got any more links? :)
 

EvanFerguson

Banned
May 14, 2001
956
0
0
they're data structures........

it's a way to store data and find it and manipulate it and crap


you can even use trees for math equations and stuff


of course, I got an F in that class......shizit
 

pen^2

Banned
Apr 1, 2000
2,845
0
0
basically its a tree that could grows upside down, possibly in a very odd shape :)
 

Elledan

Banned
Jul 24, 2000
8,880
0
0


<< basically its a tree that could grows upside down, possibly in a very odd shape :) >>

And it's an algorithm?

I'm pretty bad at algorithms, so I guess I've some work to do if I want to understand any of it :)
 

ThisIsMatt

Banned
Aug 4, 2000
11,820
1
0
Elledan - like said, it's a data structures thing. As I said earlier, it's a binary tree (each node has only two children) with the condition that all descendents that are smaller than the parent node fall to the left and all larger to the right when the tree is made. When the tree is searched, the first node (the root node) is compared with the search value - if the value being searched for is smaller than the root node, the search continues down the left side of the tree. It gets to the next node (which by definition is smaller than the previous node, the root node in this case). It is then compared to this current node and lets say it is larger than the current node. It then goes to the next node to the right of the current node because it was larger. This continues until the search finds what it's looking for or you run out of nodes. This can be done using linked lists, each node having a reference to &quot;left&quot; and &quot;right&quot;...
 

TripleJ

Platinum Member
Apr 29, 2001
2,667
0
0
Hehe, when I first looked at BST, I thought it stood for BullSh!t Tall Tree. So how do you find the height of a bullsh!t tall tree?