We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
It's the types. Insert is defined in the Binary SearchTree class and .lef/.rigth are defined in the Node class. I tried making each .left/.right into a BinarySearchTree and then making each root into a Node but then it fails on preOrder when they need to be BinarySearchTrees again.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Binary Search Tree : Insertion
You are viewing a single comment's thread. Return to all comments →
It's the types. Insert is defined in the Binary SearchTree class and .lef/.rigth are defined in the Node class. I tried making each .left/.right into a BinarySearchTree and then making each root into a Node but then it fails on preOrder when they need to be BinarySearchTrees again.