x=change(x)

Suppose that you are writing some sort of recursive function on a tree, which is in the x=change(x) style. What are the parameters, and what does it return?

There is one parameter and

And it will return the x

Some programmers like to write recursive methods, such as bst_insert(), as methods inside the node class. But in this class, I've encouraged you to write functions which are not methods of any class, instead taking the root of the tree as a parameter.

Why did I argue for this style? What advantage does it have over a method?

Because using recursion it will check the all condition present in change of (x)

Which help to looping the values present in x then it will store the value in x.

And it will make efficient  to binary search tree algorithm.

What is the runtime cost of the function below? This question is multiple choice

-          O(n^2)

Give an example of an array operation that has an average runtime complexity of O(n):

·         Linear Search

def search_ Linear(array, n, value):

for i in range (0, n):

if (array[i] == value):

return i;

return -1;

Explain why the algorithm you chose runs in O(n).