Question d’entretien chez Lemnisk

Given an array representing insertion order in a BST, find the root-to-node path for any given node.

Réponses aux questions d'entretien

Utilisateur anonyme

4 avr. 2014

1) Take to variables loverLimit and upperLimit 2) for each element in array 3) If element == node ; add element to path and return 4) If element is less than Node 5) if element is greater than than lower limit 6) add element to the path 7) update the lowerLimit = element 8) else move without doing anything

Utilisateur anonyme

1 juil. 2014

Would like to correct the above approach to also include the case where we update the upperLimit. If element is greater than Node if element is less that upperLimit update upperLimit else don't do anything