Computer Science, asked by zithbear4391, 1 year ago

Given a bst (binary search tree) with n number of nodes and a node x (which is definitely present in the input bst). You need to remove the node x and return the root of updated bst.

Answers

Answered by rajisaisahasra
0

Answer:

Answer:this is a program in python(since we learn python)

def bin_search(a,s):

   l=len(a)-1

   f=0

   while f != l:

       m=(f+l)//2

       if a[m]>s:

            f=m

       elif a[m]<s:

            l=m

       else:

            q=a[:m]+a[m+1:]

            break

   return q

a=[<the list>]

a.sort

s=int(input('Enter elemnt to be deleted'))

print(bin_search(a,s)

#      The given list should be of numbers(not strings)

Read more on Brainly.in - https://brainly.in/question/9952891#readmore

Explanation:

Similar questions