Question 1
Two data structures that can be used to store a collection of data records are a hash table and a sorted list.
Explain why a record in a hash table can normally be found more quickly than a record in a sorted list.
[1 mark]
Answer
Describe the steps involved in adding a new record to a hash table.
[4 marks]
Answer
Explain why the time taken to find a specific record in a hash table can increase when lots of records are stored in the table.
[1 mark]
Answer
Linear search and binary search are two algorithms that could be used to find a record in a sorted list.
Explain why the linear search algorithm has time complexity of O(n).
[1 mark]
Answer
Explain why the binary search algorithm has time complexity of O(log n).
[1 mark]
Answer
State one advantage of a linear search compared to a binary search.
[1 mark]
Answer
If the list of records was unsorted, a bubble sort algorithm or a merge sort algorithm could be used to sort the records.
Explain why both these sorting algorithms are tractable.
[1 mark]
Answer
After how many passes is bubble sort guaranteed to have sorted any list of 100 items?
[1 mark]
Answer