Usage: Enter a key as a number. Click the Next button to perform one comparison. Click the Reset button to start over with a new
random list of the specified size (min 3 and max 20). The Custom Input button enables you to enter a custom list.
i: 1
↓
i
A list is filled with random numbers.
1 publicstaticint linearSearch(int[] list, int key) {
2 for (int i = 0; i < list.length; i++) {
3 if (key == list[i])
4 return i;
5 }
6 return-1;
7 }