User Tools

Site Tools


searching

Differences

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

Link to this comparison view

Next revisionBoth sides next revision
searching [2020/02/03 09:19] – created cthielsearching [2020/02/03 09:29] cthiel
Line 2: Line 2:
  
 To test different methods (algorithms) we want to make a StopWatch to time how long it takes to do a search. To test different methods (algorithms) we want to make a StopWatch to time how long it takes to do a search.
 +
 +{{ ::stopwatch.java |}}
 +
 +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 ''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.
  
  
  
searching.txt · Last modified: 2021/01/21 11:52 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki