## Purpose

The purpose of this assignment is to practice your analysis of algorithm complexity. It is recommended that this assignment be printed, and that the work be done right on it. This assignment is to be submitted in paper form to the assignment boxes, just to the left of the elevators, on the second floor of the Goldberg CS Building. For each of the algorithms below:

1. Derive the cost function for the algorithm. Be sure to show your work like we do in lectures.
2. State the complexity of the algorithm in Big-Oh.
3. Prove that the derived cost function is in the stated order (big-Oh).

## Problem 4: Longest Common Subsequence

Based on code from https://en.wikipedia.org/wiki/Longest_common_subsequence_problem

## Problem 6: Factorization

Note: Recall that the range of values of an n-bit integer is 0 … 2^n.

## Hints and Suggestions

• Print this assignment and show your work right on it.
• Feel free to use O(1) instead of specific constants when analyzing the algorithms.
• Be sure to show your work!

## Grading

Each problem will be graded out of 10 points:

• 4 marks for deriving the correct cost function. The cost function should be of the correct order, and it should be clear how it was derived from the algorithm. One mark for the correct answer, three marks for showing your work.

• 2 marks for identifying the correct order of the function (big Oh). One mark for the correct order, and one mark for correct notation. I.e., no multiplicative constants, or multiple terms.

• 4 marks for justifying your answer. Follow the steps discussed in lecture. Approximately, 1 mark per step.

## What to Hand In

Submit you assignment in hardcopy (paper form) to the submission box, which is located to the left of the elevators, on the second floor of the CS Goldberg Building.