CSC 202 Final Exam Preparation
o Study all material covered before the midterm exam, and in particular, revise
Assignment 1 and the midterm exam
o Be able to do thorough analyses on any of the following algorithms: binary search,
bubblesort and quicksort.

CSC 202 Homework 3
Instructor: Dr Augustine S. Nsang
Date Due: Wednesday March 23, 2016
Question:
Implement the following two sorting algorithms in Ruby:
i)
ii)
Bubblesort
QuickSort
Use each of the two sorting algorithms you have implemented to sort the f

# Part (B)
# USMAN IDRIS KWARU
# A00017145
#Question 4(i)
def power(x,n)
if n = 0
return 1
else
x*power(x,n-1) #or x*n
end
end
puts power(5,6)
#Question 4 (ii)
def max (l)
max = l[0].to_i
for i in 0.l.size-1
if max < l[i].to_i
max = l[i]
end
end
return ma

CSC 202 Homework 2
Instructor: Dr Augustine S. Nsang
Date Due: Wednesday, March 2, 2016
SECTION A:
Question 1:
Consider the following function:
function revlist (a[0.n])
allocate b[0.n]
for i = 0 to n
b[n i] = a[i]
return b
i
ii
Explain what it does
Takin