CodeTest

Please review my sample code as per the questions asked

Question 1.

a. write a function that returns true if a prime number

checkIfPrime(int number): returns true if is a prime number

b. memorize function that takes any other function as input and returns a memorized version of that function.

memorize(Object object): memorizes and returns the same object

c. memorize prime function

memorize(checkIfPrime(29)) : returns a memorized version of the prime method

Question 2.

Binary search on the collection.

binarySearch(int collection[], int searchVal) : returns the position of the search item nad -1 if the item doesn't exist in the collection