Array notes
Array notes
Question 3
Answer
1
One-dimensional array stores Two-dimensional array stores data in a grid
data in a single row or column. or table, with rows and columns.
It uses one index to access It uses two indices to access array elements.
array elements.
Question 4
What is the difference between linear search and binary search?
Answer
Linear Search Binary Search
Linear search works on sorted and Binary search works only on sorted
unsorted arrays. arrays (both ascending and
descending).
Each element of the array is checked Array is successively divided into 2
against the target value until the halves and the target element is
element is found or end of the array searched either in the first half or in the
is reached. second half.
Linear Search is slower. Binary Search is faster.
Question 5
Explain
Answer
2
(i) Linear Search — Linear Search refers to the searching technique in which
each element of an array is compared with the search item, one by one, until
the search-item is found or all elements have been compared.