TUTORIAL QUESTIONS FOR INTRO TO ALGORITHMS
Section 1: Foundational Concepts (Understanding)
1. Definition and Characteristics:
(a) Define what an algorithm is in the context of computer science. (2 marks)
(b) Discuss five key characteristics of a good algorithm, providing examples to illustrate each
characteristic. (8 marks)
2. Algorithm Representation:
(a) Describe three different methods used to represent algorithms. Provide an advantage and
disadvantage for each. (9 marks)
(b) Create a simple algorithm (e.g., to find the sum of two numbers) using both pseudocode and a
flowchart. (6 marks)
3. Algorithm Efficiency:
(a) Explain the concepts of time complexity and space complexity in relation to algorithms. (4 marks)
(b) Discuss why algorithm efficiency is important in software development. Provide real-world scenarios
to support your claims. (6 marks)
Section 2: Algorithm Analysis (Application and Analysis)
4. Searching Algorithms:
(a) Describe the differences between linear search and binary search algorithms. (4 marks)
(b) Given a sorted array of numbers [2, 5, 8, 12, 16, 23, 38, 56, 72, 91], trace the steps involved in using
a binary search algorithm to find the value 23. Show all intermediate steps including the array indexes
used.(10 marks)
(c) Explain in which scenarios you would choose a linear search over a binary search, and why? (3
marks)
5. Sorting Algorithms:
(a) Describe the working principle of the bubble sort algorithm. (5 marks)
(b) Trace the steps involved in sorting the following array using a bubble sort algorithm: [6, 5, 3, 1, 8, 7,
2, 4]. Show all intermediate steps including the array values during each iteration.(10 marks)
(c) Compare bubble sort to another sorting algorithm such as insertion sort, in terms of efficiency and
suitability for different use cases (5 marks)
6. Big O Notation:
(a) Explain what Big O notation is and how it is used to describe algorithm complexity. (4 marks)
(b) Provide the Big O notation for the following time complexities (4 marks):
Linear Search
Binary Search
Bubble Sort
Quick Sort
(c) Explain why we use Big O notation to describe the asymptotic behavior of algorithms rather than
exact runtimes. (4 marks)
Section 3: Algorithm Design (Problem Solving)
7. Algorithm Design Scenario:
• Design an algorithm to find the second largest number in an unsorted array of integers.
(a) Provide the steps of your algorithm using pseudocode. (10 marks)
(b) Briefly describe the time complexity of your algorithm using Big O notation (3 marks)
(c) Explain any assumptions you've made about the array such as whether it has unique integers or if
it has at least two elements etc. (2 marks)
8. Practical Algorithm Application:
• You are tasked to develop a program for a library to manage book records, the library wants to be
able to find the book easily based on the ID and the author of the book.
(a) Explain what data structures are suitable to store book records, explaining why you chose those
data structures. (5 marks)
(b) Explain which algorithms would be most appropriate for efficient book searching based on the
book ID and the Author. (5 marks)
(c) Provide the pseudocode for at least one of these algorithms that you chose, explaining what
happens in each step. (8 marks)