Tree traversal: Difference between revisions

Content deleted Content added
No edit summary
Line 518: Line 518:
queue["tail"] = 0
queue["tail"] = 0
queue[queue["head"]++] = node
queue[queue["head"]++] = node



while (queue["head"] - queue["tail"] >= 1) {
while (queue["head"] - queue["tail"] >= 1) {
Line 530: Line 529:
if (child[1] != "")
if (child[1] != "")
queue[queue["head"]++] = child[1]
queue[queue["head"]++] = child[1]

if (child[2] != "")
if (child[2] != "")
queue[queue["head"]++] = child[2]
queue[queue["head"]++] = child[2]