Question 6

OCR Computer Science June 2023 Algorithms and problem solving (H046-02)AS10 marks

On the specification

(a)(i)
2.3 Algorithms
(a)(ii)
2.3 Algorithms
(b)
1.4 Data types, data structures and algorithms2.3 Algorithms
Question text

6 A program stores data in a 1-dimensional array. (a) The program needs to search the array for a number that is input by the user. (i) Describe how a linear search will search the data in the array for a number that has been input. [5] (ii) State why you would use a linear search rather than a binary search. [1] (b) Describe how an array can be used to store and access data in a stack data structure. [4]