Write a program that animates the linear search algorithm. Create an array that consists of 20 distinct

Question:

Write a program that animates the linear search algorithm. Create an array that consists of 20 distinct numbers from 1 to 20 in a random order. The array elements are displayed in a histogram, as shown in Figure 22.12. You need to enter a search key in the text field. Clicking the Step button causes the program to perform one comparison in the algorithm and repaints the histogram with a bar indicating the search position. This button also freezes the text field to prevent its value from being changed. When the algorithm is finished, display the status in the label at the top of the border pane to inform the user. Clicking the Reset button creates a new random array for a new start. This button also makes the text field editable.image

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: