Domanda di colloquio di IBM

How do you search for an element in a binary tree?

Risposta di colloquio

Anonimo

5 dic 2020

Initially we start with root node. At first we check if the given number is equal to the root node value,if yes we stop searching further and if not we check if the given value is less the root node value or greater than it..if it's greater we move on to the right subtree of the parent root else to the left.This way the algorithm goes on.