Introduction
Arrays are multi-valued variables of a particular type.
82.6 | 91.4 | 65.6 |
for (i=0; i < SIZE; i++) arr[i] = rand() % 100;
for (i=0; i < SIZE; i++) cout << arr[i] << " ";
for (i=0; i < SIZE; i++) array1[i] = aray2[i];
total = 0; for (i=0; i < SIZE; i++) total = total + arr[i];
double max = arr[0]; for (i=1; i < SIZE; i++) { if (arr[i] > max) max = arr[i]; }
double temp = arr[0]; for (i=1; i < SIZE; i++) { arr[i - 1] =arr[i] ; } arr[i - 1] = temp;
set low to 0 set high to size of array - 1 while high >= low calculate mid if searchfor < array[mid] high = mid -1 else if searchfor == array[mid] answer is mid else low = mid + 1Binary Search