[英]Traversal BST assignments
I was writing a method to print a BST in traversal order. 我正在编写一种以遍历顺序打印BST的方法。 Also, to represent the depth of each node, I wish to place a tab or "/t" string within the word to represent depth.
另外,为了表示每个节点的深度,我希望在单词内放置一个制表符或“ / t”字符串以表示深度。 The problem is that when I run the code, I get the result:
问题是,当我运行代码时,会得到结果:
image http://neuropod.net/imagehost/uploads/9d94c563260731cb024df2801f899f3c.png 图片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
我当时在想,也许是我的错误是我不允许我尽可能多地访问else循环,因为我期望这样的打印出来
image http://neuropod.net/imagehost/uploads/110cf543dd0f141c3ad1b9b1cb9cf5ed.png 图片http://neuropod.net/imagehost/uploads/110cf543dd0f141c3ad1b9b1cb9cf5ed.png
To print a tab, you use "\\t"
(note, that is a backslash). 要打印选项卡,请使用
"\\t"
(注意,这是一个反斜杠)。 "\\t"
is called an "escape sequence" . "\\t"
被称为“转义序列” 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.