Two examples of searching algorithms are a linear search and a binary search.
Describe how increasing the number of data items in the file to be searched affects the time efficiency of these search algorithms. Refer to Big O notation in your answer.
Answer
0 words
10(b)File Handling ExceptionsHard6 marks
A temperature in degrees Celsius (∘C) is recorded every minute for one day in a random file, Temperatures.dat.
A function is required to find the temperature for a specific time in the day to check if it was freezing. The position of each temperature in the file corresponds to the number of minutes after midnight, for example, the temperature at 10:00 am would be stored at position 600 (10 × 60).
Write the pseudocode to complete the algorithm to check a temperature stored in Temperatures.dat, by passing its position in the file as a parameter and using file handling commands to find the relevant data item. Once the temperature is found, it is checked to see if it is above or below freezing, and an appropriate message is returned.
Some of the blank lines may not be used. Write the complete pseudocode for the function, including the lines already given below.