Professional Documents
Culture Documents
Searching .: Riddhi and Ananya
Searching .: Riddhi and Ananya
1. Linear search
2. Binary search
Linear Search
Iterating over an array one element at a time until the search value is found.
Steps
Comparing the middle element of a sorted array with the search value
repeatedly in order to find the search value.
Steps
Linear Binary
Effective for small data sets or Effective for large data sets
when search value is the first
value in the data set
Write the algorithm for the above data set, where the user inputs a value
they wish to find. The algorithm must output:
b) 2 marks for initialising all variables and data structures correctly and
using appropriate variable names
1 mark correct loop structure
3 marks for correct comparisons (if else statements)
1 mark for correct output
1 mark for calculating and outputting position
1 mark for calculating and outputting steps
2 marks for explaining all variables and data structures used
Sorting
Bubble sort
Iterating over the array and swapping the smallest element of the
unsorted array with the last element of the sorted side.