简体   繁体   中英

Traversal BST assignments

I was writing a method to print a BST in traversal order. Also, to represent the depth of each node, I wish to place a tab or "/t" string within the word to represent depth. The problem is that when I run the code, I get the result:

image http://neuropod.net/imagehost/uploads/9d94c563260731cb024df2801f899f3c.png

It does not print out the last element and times does not have the same indent as worst. I was thinking that maybe my mistake is that I am not allowing the else loop to be accessed as much as I need it to be I expected something like this to print out

image http://neuropod.net/imagehost/uploads/110cf543dd0f141c3ad1b9b1cb9cf5ed.png

To print a tab, you use "\\t" (note, that is a backslash). "\\t" is called an "escape sequence" .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM