Professional Documents
Culture Documents
Csi323 Hw1
Csi323 Hw1
Homework #1
Due date: September 11, 2023 at 10am
Instructions
• Names (and student numbers) of all group members must appear on all files submitted. This
requirement includes source code files.
• You are to submit all implementations as source code files (.java or .ram) and all written
solutions as PDF.
3. An array A[1 : n of integers is arranged such that at first the integers are increasing then they
decrease. This means that there is an index k such that A[1] < A[2] < · · · < A[k − 1] < A[k]
and A[k] > A[k + 1] > · · · > A[n − 1] > A[n]. For k, A[k + 1] < A[k] < A[k − 1]. In fact, A[k]
is the maximum element in the array.
4. Write a RAM program to compute 2n when n ≥ 0 is the input. What is the uniform cost
time and space complexity of your RAM program in terms on n?
Implement the MoveToFront data type making the methods as efficient as possible.