java - Print the elements in the tree that start with a vowel in reverse alphabetic order -
in given binary search program have print elements in tree start vowel in reverse alphabetic order. unable it. leaving nodes without traversing. please help.
public void reverseordertr() { reverseordert(root); } private void reverseordert(binarytreenode t) { if (t != null) { string v = t.nodedata; char tav = (character.touppercase(v.charat(0))); if (tav == 'a' || tav == 'e' || tav == 'i' || tav == 'o' || tav == 'u') { reverseordert(t.rightnode); system.out.print(t.nodedata + " "); reverseordert(t.leftnode); } } }
you traversing subnodes of nodes vowel-starting data.
move test deeper block, around print
function.
Comments
Post a Comment