Search(T,k)
x<- root[T]
while x != NULL and k != key[x]
do
if k<key[x]
then x <- left[x]
else x <- right[x]
return x
I just started with algorithms and I often see "<-" this and key[x] terminology can someone tell me what is key is it an array ? x was getting the root value and then it is used as an index ? I fail to understand this. Please explain.
xinkey[x]is not an index. It actually means "the value of key at nodex". Similarly withleft[x]and right[x], they mean "the left and right nodes ofx.<-` is simply an assignment statement.key[x]asx.key,left[x]asx.leftand so on.