Created
December 27, 2015 14:39
-
-
Save AlexJuca/322d1d95ee7c5b677c8a to your computer and use it in GitHub Desktop.
timedLinearSearch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void findStudent(int key, int[] studentList) { | |
final long startTime = System.nanoTime(); | |
int N = studentList.length; | |
for(int i = 0; i < N; i++) { | |
if(studentList[i] == key) { | |
System.out.println("Key has been found"); | |
} else System.out.println(" Key was not found "); | |
} | |
final long endTime = System.nanoTime(); | |
System.out.println("Total execution time: " + (endTime - startTime) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment