摘要:
1 public class BinarySearch{ 2 public int BinarySearch(int[] array, int target){ 3 if(array == null || array.length = 0){ 4 return -1; 5 } 6 while (left ... 阅读全文
摘要:
1 public class Power{ 2 public long power(int a, int b){ 3 if (b == 0){ 4 return 1; 5 } 6 if (a == 0) { 7 return 0; 8 } 9 10 ... 阅读全文
摘要:
1 public class Fibonacci{ 2 3 4 public long fibonacci(int k) { 5 if (int k <= 0) { 6 return 0; 7 } 8 long[] array = new long[k + 1]; 9 array[1]... 阅读全文
摘要:
1 public class QuickSort { 2 Random rand = new Random(); 3 public int[] quickSort(int[] array) { 4 if (array == null || array.length = 0) { 5 return array; 6 ... 阅读全文
摘要:
Given an array of integers, sort the elements in the array in ascending order. The selection sort algorithm should be used to solve this problem. Exam 阅读全文