cs102:fall2012:lab7
Lab 7 - Recursion
Write a recursive method that takes a decimal value as an int parameter and prints out the binary equivalent of it on the console. E.g., if your method is passed the integer value 5 (decimal) it should print 101 (binary). void printInBinary(int decimalValue)
Redo the above so that it returns the result as a String, rather than directly printing it on the console. String convertToBinary(int decimalValue)
Write a method to do the inverse, that is, given a binary number (as a String), return the corresponding decimal int value.
int convertToDecimal(String binaryValue)
Implement selection sort using recursion. void selectionSort(Comparable[] list)
Implement binary search using recursion (returns the index).
int binarySearch(Comparable[] sortedList, Comparable target)
cs102/fall2012/lab7.txt · Last modified: 2013/10/14 13:57 by bgedik