ajnavi
BAN USERpublic class BinarySearch {
public int sort(int searchItem, int[] sortedArray, int lower, int upper) {
int mid = lower + (upper - lower) / 2;
if (sortedArray[mid] == searchItem)
return searchItem;
else if (sortedArray[mid] > searchItem) {
return sort(searchItem, sortedArray, lower, mid - 1);
} else {
return sort(searchItem, sortedArray, mid + 1, upper);
}
}
public static void main(String[] args) {
int[] arr = {10, 5, 6, 9, 2, 1, 102, 56, 2, 1};
BinarySearch bs = new BinarySearch();
BubbleSort sort = new BubbleSort();
int[] sortedArray = sort.sort(arr);
int len = sortedArray.length;
int lower = 0;
int upper = len - 1;
int mid = (upper - lower) / 2;
bs.sort(10, sortedArray, lower, upper);
for (int i = 0; i < sortedArray.length; i++) {
System.out.println(sortedArray[i]);
}
}
}
public class reverseString {
public static void main (String[] args) {
String str = new String ("hello World");
char[] c = str.toCharArray();
int first = 0;
int last = str.length() -1;
while (first < last) {
char tmp = str.charAt(first);
c[first] = str.charAt(last);
c[last]= tmp;
first++;
last--;
}
System.out.println(new String(c));
}
}
{{ { public static void main(String[] args) {
String str = new String("ffgggtvshjsdhjfffffffhvjbjcharu");
HashMap<Character, Integer> map = new HashMap<Character, Integer>();
int counter = 1;
int flag = 0;
int max = 0;
int storeIndex = 0;
for (int i = 0; i < str.length() - 1; i++) {
if (str.charAt(i) == str.charAt(i + 1)) {
counter = counter + 1;
flag = 1;
}
else if (max < counter && flag == 1) {
max = counter;
storeIndex = i;
flag = 0;
counter = 1;
}
}
}}}
1. Valid inputs
- ajnavi July 31, 20182. Invalid inputs
3. security concern
4. user acceptance
5. Boundary coverage
6. mandatory fields