Ics 2105 Data Structures & Algorithm
Ics 2105 Data Structures & Algorithm
a) i. In your experience in today’s life, where do you think you can apply the concept
of algorithms? Discuss with an example. [6 marks]
iii. Write an implementation of the algorithm you have written in 2 using a high level
language. [3 marks]
d) i. List and explain the three major asymptomatic notations used to represent the
space/time complexity of an algorithm. [6 marks]
ii. State any three factors that influence the running time of a given algorithm.
[3 marks]
sum=0
for (i=0;i<n,i+ +){
j=i;
1
for(j=n; j>0;j/2){
sum=sum+i;
}
}
Question Two
iii. Write down an algorithm used to delete an element from a list. [6 marks]
b) i. Write a pseudo code algorithm that prompts the user for 3 integers (N1,N2, and
N3), finds the biggest integer and prints it. [6 marks]
ii. Implement algorithm into a program using a high level language. [4 marks]
Question Three
ii. Write an algorithm demonstrating the pop and push operations of a stack ADT.
[8 marks]
b) Define what a spanning tree is and hence give its properties. [6 marks]
Question Four
a) i. Write a method/procedure that accepts and unsorted integer array and uses the
merge sort algorithm to sort the array. [10 marks]
ii. Write an algorithm (pseudo code or structural English) to represent the diguue and
Enguue operation. [8 marks]
2
Question Five
a) Using the data structure illustrated below, answer the following questions:
3
4