• Post Reply Bookmark Topic Watch Topic
  • New Topic

Recursion Question/Problem  RSS feed

 
Gabriel White
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Yall, I have a Binary Tree constructed of numbers(Integers) from 0-9. I have them in a tree and I am trying to print them in , in, pre, and post order. My recursion works for the inOrder and preOrder, but it dishes out a null pointer exception when I try my postOrder.
I would appreciate any help.
Thanks.
M2k

 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You've forgotten the set of braces around the three statements controlled by the "if (n != null)".
 
Gabriel White
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OMG!!!
what a dumb post. Well at least that was an easy one to spot. I guess I needed a fresh set of eyes on that one.
Thanks E.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!