Explain your algorithm and evaluate its time complexity | Computer Science

Explain your algorithm and evaluate its time complexity | Computer Science

1. Write the definition of (0.5 mark);

then prove that (()) = 3 when () = 53 + 22 − 4. Find0, 1,0. (1.5 marks)

2. Find () for the following recurrence for the running time:

2.1 () = ( − 1) + 1 (0.75 marks)

2.2 () = 3 (

3 ) + 1 (0.75 marks)

2.3 () = (

2 ) + 1 (0.75 marks)

3. In Chapter 4 of our reference book (Introduction to algorithms), read Strassen’s algorithm for

matrix multiplication and answer the following questions.

3.1 Write the recurrence for the running time of Strassen’s algorithm and find its . (0.5 marks)

3.2 Use the algorithm to compute the matrix product:

( 7 4 1 3

) ( 5 3 2 5

)

Show your work. (0.25 marks)

Programming: (5 Marks)

1. Implement a divide and conquer algorithm for the following problem.

You have an × board, where = 2. One of the cells is black. You should fill the board with

an L shape which is a 2 × 2 tile with a missing cell without any overlaps with the black or L

shapes. You are allowed to rotate the L shape 90 degree multiple times. Explain your algorithm

and evaluate its time complexity.

(3,3)

(0,0) (1,0)

Given board and

index of its cells

L shape

Result

Input: n,a,b.

n: number of cells in rows and columns,

a: X index of the black cell,

b: Y index of the black cell.

For example for the above example, input is:

4,1,2. Since the board is 4 by 4 and the black cell is located at (1,2).

Output: a sequence of a,b,d for all the L shapes in the form of a0,b0,d0; a1,b1,d1;….;

ak,bk,dk.

a: X index of the yellow cell in L shape,

b: Y index of the yellow cell in L shape,

d: degree of the rotation.

For example: 0,0,270; 0,3,0; 2,1,180; 3,0,180; 3,3,90; is the output for the above example.

Both output and input are given as text files.

Order from us and get better grades. We are the service you have been looking for.