### Write the function definition as a recursive search

Assignment Help Data Structure & Algorithms
##### Reference no: EM13963253

1. A sequential search member function of Sorted Type has the following prototype: void Sorted Type::Search( int value, bool & found);

a. Write the function definition as a recursive search, assuming a linked list implementation.

b. Write the function definition as a recursive search, assuming an array based implementation.

2. We want to count the number of possible paths to move from row 1, column 1 to row N, column N in a two-dimensional grid. Steps are restricted to going up or to the right, but not diagonally. The illustration that follows shows three of many paths, if N = 10:

a. The following function, NumPaths, is supposed to count the number of paths, but it has some problems. Debug the function.
int NumPaths(int row, int col, int n)

{
if (row == n)
return 1;
else
if (col == n)
return NumPaths + 1;
else
return NumPaths(row + 1, col) * NumPaths(row, col + 1);
}

b. After you have corrected the function, trace the execution of NumPaths with n = 4 by hand. Why is this algorithm inefficient?

c. You can improve the efficiency of this operation by keeping intermediate values of NumPaths in a two-dimensional array of integer values. This approach keeps the function from having to recalculate values that it has already figured out. Design and code a version of NumPaths that uses this approach.

d. Show an invocation of the version of NumPaths you developed in part (c), including any array initialization necessary.

e. How do the two versions of NumPaths compare in terms of time efficiency? Space efficiency?

#### Write a program to implement the inverted file

Write a program to implement the inverted file shown in the slides (Simple Index file, LabelID file and Data file).  Use the Avail_List to point at the deleted Label IDs so th

#### Er modeling

A supplier supplies certain number parts for a assignment, a assignment uses the parts from the different suppliers, and the same kind parts from different suppliers are used

#### Algorithm on dynamic programming-minimize amount of walking

Our goal is to plan this trip so that we minimize the maximum amount of walking done in a single day. Your algorithm should be based on dynamic programming and run efficiently

#### Write specifications using uml notation for a function

Write specifications using UML notation for a function that computes the sum of the first five positive integers in an array of  n  arbitrary integers.

#### Operation when you use the quick union algorithm

Show the contents of the id array after each union operation when you use the quick union algorithm (Program below) to solve the connectivity problem for the sequence 0-2, 1

#### Equation apply boolean algebra

Using this equation apply boolean algebra in order to prove the commutative and associative properties for binary addition: x(+)y=y(+)x  (x(+)y)(+)z=x(+)(y(+)z)

#### Prove that you should not also use the greedy strategy

Prove that you should not also use the greedy strategy. That is, show that thereis a game that you can win, but only if you do not follow the same greedy strategy as Elmo.

CSE250 Fall -  Implementation has to be efficient and you have to work under certain con- straints -  certain simple functionality is best achieved by a data structure that b