10 marksSearching and Sorting Algorithms
CAPE Computer Science Unit 2 · 2009 · Paper 2 · Question 2(a)(i)
Searching an array of integers.
Write a function, lsearch, which takes an integer array arr, its size n, and a search key, performing a linear search to return the index where key is found, or -1 otherwise.
The mark scheme is shown once you've answered.
Practise this question