Data Structures and Algorithms
Assignment 1
In groups of 5 Due 1 May 2025
QUESTION 1
You are required to provide an implementation of a queue based on a singly linked list.
Using suitable illustrative diagrams, explain how you might do this. Your answer should pay
particular attention to the location and resulting efficiency of the insertion and deletion
operation. [10 marks]
QUESTION 2
a) Write a procedure that counts the number of vowels in a given character string.
[5marks]
b) Create a program that can take a positive integer greater than 2 as input and print
out the number of times one must repeatedly divide this number by 2 before getting a
value less than 2 [5marks]
QUESTION 3
a) What are the merits and demerits of array implementation of lists? [6 marks]
b) Explain the greedy algorithm and its applications. [4 marks]
QUESTION 4
a) Explain any FIVE operations of the stack? [5 marks]
b) Write the routine to push an element into a stack [5 marks]