## Binary Trees make me sick :(

• Topic Archived
1. Boards
2. Game Design and Programming
3. Binary Trees make me sick :(
 ISDcaptain013 years ago#1 Okay so Im reading a book called "Data Structures for Game programmers" and im on the chapter where we study binary trees. Making the tree and understanding it was easy enough. But making function that automotically travels through it in various orders is brain melting lol. Im dealing with function pointers here, but thats not the problem, the intense recursion is getting to me.How was your experience with binary trees?lol at --> http://boards.gamefaqs.com/gfaqs/user.php?=89123 neoX3 years ago#2When learning a new algorithm I usually do it in Python real quick and play with recursion and iterative versions until I fully understand them. Then implementing them in other languages is trivial. :)http://www.goo.gl/en6H3 PTP20093 years ago#3Being good with recursion involves trusting that the recursive calls will work correctly, even though the code isn't working yet (because you're in the process of writing it). For in-order traversal of trees, for example, you first recursively traverse the left side, then do the current element, then recursively traverse the right side. ISDcaptain01 (Topic Creator)3 years ago#4since Im not a CS student, what do they make you do in the intro data structures class in school?lol at --> http://boards.gamefaqs.com/gfaqs/user.php?=89123 OrangeWizard3 years ago#5From: ISDcaptain01 | #004since Im not a CS student, what do they make you do in the intro data structures class in school?lots of push-upsTrolling and making valid arguments are not mutually exclusive things. ISDcaptain01 (Topic Creator)3 years ago#6PTP2009 posted...Being good with recursion involves trusting that the recursive calls will work correctly, even though the code isn't working yet (because you're in the process of writing it). For in-order traversal of trees, for example, you first recursively traverse the left side, then do the current element, then recursively traverse the right side.yeah I implemented preorder, postordrr and in order but man are they confusing lol.I had to sit there, look at my tree graph on paper then trace through it looking at the code. That takes time to sink in.lol at --> http://boards.gamefaqs.com/gfaqs/user.php?=89123 ISDcaptain01 (Topic Creator)3 years ago#7OrangeWizard posted...From: ISDcaptain01 | #004since Im not a CS student, what do they make you do in the intro data structures class in school?lots of push-upsIf you mean mental push-ups, then yeah Id agree. No wonder the drop out rate for CS is highlol at --> http://boards.gamefaqs.com/gfaqs/user.php?=89123 ReconditePhreak3 years ago#8If you mean mental push-ups, then yeah Id agree. No wonder the drop out rate for CS is highNo, real push ups to get the blood flowing.Believes the individuals who report to moderators wish they had more control than they do. neoX3 years ago#9Push ups, pop ups, and peeks. It's a rough routine.http://www.goo.gl/en6H3 Skel13 years ago#10Loops are just tail recursion. Your mind = blown.http://patrickavella.com/ <> I'm on the intertubeshttp://twitter.com/patrickavella <> http://facebook.com/patrick.avella.blog
1. Boards
2. Game Design and Programming
3. Binary Trees make me sick :(