You are encouraged to work in groups (but not more than 2 persons in a group). Show all your computation to get full credit. Please put comments in your code. I will deduct points for uncommented code. You can write the programs in any language you choose so long as we can run it. This assignment is worth 13% of your total grade.
Prove the following statements.
is an irrational number
- If a - b is divisible by c, then
-
is divisible by c
- If
- 1 is a prime number then n is a prime number
Compute the big Oh complexity for the following recursion relations.
Create sets of integers with the following characteristics with array sizes of 100,000; 500,000; and 1,000,000 (10).
- Set where no integer is repeated
- Set where the range is 1% of the array size and the integers repeat
Compare the performances of the following sorting algorithms. You can either write the algorithms on your own or modify algorithms obtained from elsewhere (15).
Create a table with the rows being the different algorithms and the columns being the inputs. Run each input 10 times and report the mean, and standard deviation for each run. You can also represent the results as a table. Write a short summary (about 1 paragraph) on your observations (10).
- Quicksort
- Quicksort until size of set is <= 1,000; 500; 100; 10 and then using insertion sort
- Countingsort
Consider these two relaxations to the constraints of red-black trees together.
- The root can be red or black
- The red nodes can have at most one red child
List the changes to the addition and deletion rules you need to maintain these conditions (10).
Modify existing code (or write your own) of a red-black tree to include these relaxations (9).
Explain either analytically or through empirical results whether the black height will be maintained in all paths (5).
Create a set of 100,000 integers. Insert these integers to (i) the original red-black tree; and (ii) the modified red-black tree. Repeat this step about 6 times with different sets of integers, and report the mean, maximum, and minimum values of the following (4 * 4 = 16).
- Tree height
- Black height
- Time to insert
- Time to search