Page 1 of 4
FACULTY OF SCIENCE DEPARTMENT OF MATHEMATICS AND
COMPUTER SCIENCE SCHOOL FOCUSED PROGRAMME
DATA STRUCTURES AND ALGORITHMS
Duration: 2 Hours Instructions: Answer Question ONE and any other TWO
Questions.
Q1.
a) Write algorithms to
i) Insert a new node with Y in the data field in a single linked list after the
mode with X i the data field. (3 marks)
ii) Delete the node with element Y in the data field in a single linked list. (3
marks)
b)
i) Define the term linear list. (1 mark)
ii) Considering the linear list design an algorithm to insert an element x in
position. (7 marks)
iii) Draw the flow chart corresponding to question 1b(ii) above. (10 marks)
c) Define the following terms.
i) Sorting (1 mark)
ii) Graph (1 mark)
iii) Binary tree (1 mark)
iv) Node (1 mark)
d) Explain any two real life applications of graphs. (2 marks)
Computer science - Data structures and Algorithms- practice quiz
FACULTY OF SCIENCE DEPARTMENT OF MATHEMATICS AND
COMPUTER SCIENCE SCHOOL FOCUSED PROGRAMME
DATA STRUCTURES AND ALGORITHMS
Duration: 2 Hours Instructions: Answer Question ONE and any other TWO
Questions.
Q1.
a) Write algorithms to
i) Insert a new node with Y in the data field in a single linked list after the
mode with X i the data field. (3 marks)
ii) Delete the node with element Y in the data field in a single linked list. (3
marks)
b)
i) Define the term linear list. (1 mark)
ii) Considering the linear list design an algorithm to insert an element x in
position. (7 marks)
iii) Draw the flow chart corresponding to question 1b(ii) above. (10 marks)
c) Define the following terms.
i) Sorting (1 mark)
ii) Graph (1 mark)
iii) Binary tree (1 mark)
iv) Node (1 mark)
d) Explain any two real life applications of graphs. (2 marks)
Computer science - Data structures and Algorithms- practice quiz