Algorithm for binary tree with equal entries

| October 22, 2018

Given a Binary Search Tree T and a key value k, design an algorithm to efficiently locate and return all the records with key value equal to k. The psedudocode shows below, please explain when worse case occurs and provide as tight an upper bound on the worst case asymptotic running as you can.The pseudocode:Note: L=store a list of nodes with k, initially set to nil.pALL-EQUAL-(T,K,L)if T.left = kL.p = T.leftL = L.nextif T.right = kL.p = T.rightL = L.nextif T.left != NULLALL-EQUAL (T.left, K, L)if T.right != NULLALL-EQUAL (T.right, K, L)HINT: you might want to express the running time as a function of the height h of the tree and the numb found that have key values equal to k.

Order your essay today and save 30% with the discount code: ESSAYHELP
Order your essay today and save 30% with the discount code: ESSAYHELPOrder Now