questiona give the two conditions required by a


QUESTION

(a) Give the two conditions required by a binary tree of depth d to be an almost complete binary tree.

(b) Determine what the following recursive C function computes. Write an iterative function to accomplish the same purpose.

int func(int n)

{

if (n == 0)

return(0);

return(n + func(n-1));

}

(c) Write a recursive algorithm to search a sorted array a for an element x between a[low] and a[high].

(d) Use your algorithm from part (c) to search for 17 from a sorted array that contains the elements 1, 3, 4, 5, 17, 18, 31 and 33.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: questiona give the two conditions required by a
Reference No:- TGS0359621

Expected delivery within 24 Hours