Binary Trees make me sick :(

  • Topic Archived
  1. Boards
  2. Game Design and Programming
  3. Binary Trees make me sick :(
3 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
3 years ago#2
When 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
3 years ago#3
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.
3 years ago#4
since 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
3 years ago#5
From: ISDcaptain01 | #004
since Im not a CS student, what do they make you do in the intro data structures class in school?


lots of push-ups
---
Trolling and making valid arguments are not mutually exclusive things.
3 years ago#6
PTP2009 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
3 years ago#7
OrangeWizard posted...
From: ISDcaptain01 | #004
since Im not a CS student, what do they make you do in the intro data structures class in school?


lots of push-ups


If you mean mental push-ups, then yeah Id agree. No wonder the drop out rate for CS is high
---
lol at --> http://boards.gamefaqs.com/gfaqs/user.php?=89123
3 years ago#8
If you mean mental push-ups, then yeah Id agree. No wonder the drop out rate for CS is high

No, real push ups to get the blood flowing.
---
Believes the individuals who report to moderators wish they had more control than they do.
3 years ago#9
Push ups, pop ups, and peeks. It's a rough routine.
---
http://www.goo.gl/en6H3
3 years ago#10
Loops are just tail recursion. Your mind = blown.
---
http://patrickavella.com/ <> I'm on the intertubes
http://twitter.com/patrickavella <> http://facebook.com/patrick.avella.blog
  1. Boards
  2. Game Design and Programming
  3. Binary Trees make me sick :(

Report Message

Terms of Use Violations:

Etiquette Issues:

Notes (optional; required for "Other"):
Add user to Ignore List after reporting

Topic Sticky

You are not allowed to request a sticky.

  • Topic Archived