You are viewing a single comment's thread. Return to all comments →
Swift version seems to be broken and crashes for any tree with more than one node due to an error in reading the input here:
let t = Int(readLine()!)!
for _ in 0..
root = tree.insert(root: root, data: Int(readLine()!)!)
}
The problem is that the 'for' loop expects for each node data to appear on a separate line, while they all on the same line separated by commas.
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Height of a Binary Tree
You are viewing a single comment's thread. Return to all comments →
Swift version seems to be broken and crashes for any tree with more than one node due to an error in reading the input here:
let t = Int(readLine()!)!
for _ in 0..
}
The problem is that the 'for' loop expects for each node data to appear on a separate line, while they all on the same line separated by commas.