MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / linear

Function linear

CPP/searching/linear_search.cpp:3–11  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include<bits/stdc++.h>
2using namespace std;
3int linear(int arr[], int key, int n){
4 for (int i = 0; i < n; ++i)
5 {
6 if(arr[i]==key){
7 return i;
8 }
9 }
10 return -1;
11}
12void initial(){
13#ifndef ONLINE_JUDGE
14 freopen("input.txt", "r", stdin);

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected