-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearches.h
More file actions
47 lines (40 loc) · 1.32 KB
/
Copy pathSearches.h
File metadata and controls
47 lines (40 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Searches.h
* Author: Josh
*
* Created on January 16, 2018, 5:07 PM
*/
#ifndef SEARCHES_H
#define SEARCHES_H
/**
* This function performs a Linear Search on the array array.
*
* precondition: size is no larger than the size of the array array.
*
* @param array the array to be searched
* @param size the size of the array
* @param item the item to be found
* @return the index at which the item to be found item was found, or -1 if it
* was not found.
*/
int linearSearch(int array[], int size, int item);
//PRECONDITION:: array must be sorted before use
/**
* This function performs a Binary Search on the array array.
*
* precondition: size is no larger than the size of the array array.
* The array must be sorted before it is searched. <- *NOTE
*
* @param array the array to be searched
* @param size the size of the array
* @param item the item to be found
* @return the index at which the item to be found item was found, or -1 if it
* was not found.
*/
int binarySearch(int array[], int size, int item);
#endif /* SEARCHES_H */