0% found this document useful (0 votes)
14 views3 pages

SPC 2106 Data Structures and Algorithms Year I Semester I

This document outlines the examination structure for the Bachelor of Education Science degree in Data Structures and Algorithms for the 2022/2023 academic year. It includes various questions on topics such as stacks, arrays, linked lists, sorting algorithms, tree traversals, and characteristics of data structures and algorithms. Students are instructed to attempt question one and any two additional questions, with specific tasks and coding requirements provided for each question.

Uploaded by

westyjoe377
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

SPC 2106 Data Structures and Algorithms Year I Semester I

This document outlines the examination structure for the Bachelor of Education Science degree in Data Structures and Algorithms for the 2022/2023 academic year. It includes various questions on topics such as stacks, arrays, linked lists, sorting algorithms, tree traversals, and characteristics of data structures and algorithms. Students are instructed to attempt question one and any two additional questions, with specific tasks and coding requirements provided for each question.

Uploaded by

westyjoe377
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

UNIVERSITY EXAMINATION 2022/2023

EXAMINATION FOR THE DEGREE OF BACHELOR OF EDUCATION SCIENCE

SPC 2106 Data Structures And Algorithms Year I Semester I

Date: Tuesday, 13th December, 2022 Time: 8.30 am -10.30 am


Instructions

Attempt question ONE and ANY OTHER TWO Questions

Question One

a) Using a diagram, describe the operation of a stack. (4 Marks)


b) (i) Write C/C++ codes to declare a two dimension array called “MARKS”,
of two rows and three columns and of type integer. (2 Marks)
(ii) Initialize the array in d(i) with the following values: 40, 45, 50, 55, 60, 65.
(2 Marks)
c) Define the following data structures
i. Arrays
ii. Tree
iii. Queue (6 Marks)
d) With an aid of a diagram describe the two types of graphs. (4 Marks)
e) Using bubble sort, describe all steps an algorithm would use to sort the following
values. 65, 23, 89, 74. (4 Marks)
f) Distinguish between Depth first and Breadth first search of a binary tree.
(4 Marks)
g) Explain any two advantages of lists over arrays. (4 Marks)

Question Two

a) Using a diagram, distinguish between a singly linked list and doubly linked list.
(4 Marks)
b) Write a C++ code snippet for an insertion sort algorithm. (5 Marks)
c) Considering the Red-Black tree below, and answer the questions that follow:

Page 1 of 3
Required:
i. Calculate the ratio of red to black nodes. (3 Marks)
ii. With justification, determine whether the above red-black tree is balanced
(3 Marks)
d) Write a C/C++ code to declare a node of a doubly linked list. (5 Marks)

Question Three

a) Using a diagram, describe how pre-order tree traversal works. (6 Marks)


b) Using Selection sort, describe all steps an algorithm would use to sort the
following values. 34, 51, 12, 69, 83. (5 Marks)
c) Explain three characteristics of an efficient data structure. (6 Marks)
d) Using the in-order tree traversal, demonstrate how the following nodes of a
binary tree will be visited. (3 Marks)

Question Four

a) Asymptotic analysis of an algorithm refers to defining the mathematical


boundation/framing of its run-time performance. Explain the three execution
time cases usually used to compare the running time of an algorithm.
(6 Marks)
b) write algorithm to push an element into the stack (5 Marks)
c) Write a C++ code snippet for a bubble sort algorithm . (5 Marks)
d) Using a diagram, the operation of a queue. (4 Marks)

Page 2 of 3
Question Five

a) Calculate the bit matrix of the following graph. (5 Marks)

b) Outline any five characteristics of a good Algorithm. (5 Marks)


c) Write an algorithm to delete a node in a queue. (6 Marks)
d) Explain the operation of a binary search algorithm. (4 Marks)

Page 3 of 3

You might also like