Trace:

searching

This shows you the differences between two versions of the page.

Both sides previous revision Previous revision | |||

searching [2020/02/03 09:29] cthiel |
searching [2020/02/03 09:32] (current) cthiel |
||
---|---|---|---|

Line 7: | Line 7: | ||

We also want to generate a bunch of things to search. We can start with integers. | We also want to generate a bunch of things to search. We can start with integers. | ||

- | - Write a class ''Numbers'' that has generates n random integers from 0 to max. It should have toString method that has ten numbers separated by a space, and then adds a \n to start a new line. | + | - Write a class ''Numbers'' that has generates n random integers from 0 to max. It should have toString method that has ten numbers separated by a space, and then adds a \n to start a new line. It should have a constructor, and accessor methods. |

- Write a class ''Search'' that has a stopwatch and creates a ''Numbers'' objects to reach, and have a loop that prompts for a number to search and reports if it was found and how long it took to find it. | - Write a class ''Search'' that has a stopwatch and creates a ''Numbers'' objects to reach, and have a loop that prompts for a number to search and reports if it was found and how long it took to find it. | ||

- Start with a linear search. To do a binary search we need to sort the Numbers. | - Start with a linear search. To do a binary search we need to sort the Numbers. |

searching.txt ยท Last modified: 2020/02/03 09:32 by cthiel