Linksys
Junior Member
Kenshin: It doesn't matter. Use whatever technique you like. However. Once I've said I'll kill you,
Posts: 12
|
Post by Linksys on Mar 14, 2002 21:03:33 GMT -5
Can anyone give me any hints as how to go through the whole tree? I have tried many things like using multiple helper methods and such but I keep getting stack overflow errors when trying to get back to a previous vector or node. I am only able to go through one path and when I have to go back up is where im stuck on.
Thanks
|
|
|
Post by Evotamer on Mar 15, 2002 4:36:21 GMT -5
Hmm I'm not sure what your project requires you to do.. but recursion seems to be a logical choice...
You may need to work on some kind of search pattern to regurgitate the information you want before the node you are in..
|
|
barp
Full Member
Posts: 28
|
Post by barp on Mar 15, 2002 9:14:03 GMT -5
For toString(), we have to go through the entire tree. so if our tree is; "" | | | a b c | | | | | | | d e f g h i j | k then our output is a a/d a/e b b/f c c/g c/h c/i c/i/k c/i/j it's preorder transversal....I'm going from left to right then checking downward...but....nothing works.......ahhhhhhhhhhhhh..... !!!!!!!!!!......sorry... please help with sugar....
|
|
|
Post by Random_Death on Mar 15, 2002 23:58:08 GMT -5
It's sorta like how size is organized.
|
|
barp
Full Member
Posts: 28
|
Post by barp on Mar 16, 2002 15:02:15 GMT -5
alright now i have that part, but I have to add in the indentations, ... and I have space at the top....booooo!.. I have another method for indentation...and it looks good.. but I'm having problems adding it into my toString()... I "should" be adding it after I say NEWLINE....but I can't add it there....I need it in my other method....ahhhhhhhh!!.
I've been playing around , and adding different combo.s but it doesn't work...
any suggestions??..
|
|
|
Post by Sylph on Mar 16, 2002 16:59:12 GMT -5
alright now i have that part, but I have to add in the indentations, ... and I have space at the top....booooo!.. if u have a method that works except it just has space at the top, u can just trim() the String, which removes any whitespace in the beginning and at the end of the String.
|
|
barp
Full Member
Posts: 28
|
Post by barp on Mar 17, 2002 19:20:11 GMT -5
thanks for the help!!
now i have my indentation to deal with: I have a three helper methods, one goes down the tree, second goes to the side, and the third puts in the spaces(indentations): I get the where I'm suppose to be indenting in the second method, but I need to use it in the first .
Any suggestions?
|
|
|
Post by CooLiBoP on Mar 17, 2002 23:44:58 GMT -5
Does any1 know if this is ok? ( I have /'s in front of the first urls) /www.yahoo.ca /www.yahoo.ca/~blah /www.yahoo.ca/~blah/~haha /www.yahoo.ca/~nice /www.zizzerman.com/
|
|
|
Post by Tony on Mar 17, 2002 23:49:04 GMT -5
probably not ok since it is auto marked, you also should not have / at the end
try a conditional that only adds the / if it divides 2 parts
|
|
barp
Full Member
Posts: 28
|
Post by barp on Mar 17, 2002 23:50:11 GMT -5
Nope!!!!!!!!!!!!!!!!!
sorry man, i made an if to see if to put '/' there...
but how did you do that "coo cool" indentation stuff...hehe.... I can't do it...
|
|
|
Post by Tony on Mar 17, 2002 23:54:57 GMT -5
i put everthing into toString and no helper methods, probably a lot diff that urs
try passing a String parameter somewhere
|
|
barp
Full Member
Posts: 28
|
Post by barp on Mar 18, 2002 0:01:47 GMT -5
hmmm...yeah, I did like everywhere!. and it's not working for me...maybe a ta can help me out...
|
|