0% found this document useful (0 votes)
40 views5 pages

Comp 214 Main Exam

This document contains instructions and questions for an examination on data structures for Computer Science/Information Technology students. It is divided into two sections. Section A contains one compulsory question with subquestions on comparing properties of arrays and linked lists, disadvantages of arrays, deleting a node from a binary tree, implementing hashing, and applications of trees. Section B contains four optional questions, each worth 20 marks, involving drawing diagrams for inserting nodes into linked lists, determining properties of a tree, finding the minimum spanning tree using Kruskal's algorithm, constructing expression trees, implementing queues and stacks, and inserting keys into a B-tree.

Uploaded by

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

Comp 214 Main Exam

This document contains instructions and questions for an examination on data structures for Computer Science/Information Technology students. It is divided into two sections. Section A contains one compulsory question with subquestions on comparing properties of arrays and linked lists, disadvantages of arrays, deleting a node from a binary tree, implementing hashing, and applications of trees. Section B contains four optional questions, each worth 20 marks, involving drawing diagrams for inserting nodes into linked lists, determining properties of a tree, finding the minimum spanning tree using Kruskal's algorithm, constructing expression trees, implementing queues and stacks, and inserting keys into a B-tree.

Uploaded by

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

KABARAK UNIVERSITY

UNIVERSITY EXAMINATIONS
MAIN CAMPUS
THIRD SEMESTER, 2022 ACADEMIC YEAR
EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE
COMPUTER SCIENCE/ INFORMATION TECHNOLOGY

COMP 214: DATA STRUCTURES

STREAM: Y2/S1 - REGULAR TIME: 9:00-11:00AM


EXAMINATION SESSION: SEPT-DEC DATE: 7/12/2022

INSTRUCTIONS
1. Answer Question 1 and any other two questions in the answer booklet provided.
2. Do not write on your question papers. All rough work should be done in your answer
booklet.
3. Clearly indicate which question you are answering.
4. Follow all the instructions in the answer booklet
5. Write neatly and legibly

As members of Kabarak University family, we purpose at all times and in all places, to set apart in one’s heart, Jesus
as Lord. (1 Peter 3:15)
Kabarak University is ISO 9001:2015 Certified
Page 1 of 5
SECTION A: (COMPULSORY) TOTAL MARKS FOR THIS SECTION IS 30.
1.
(a) Compare arrays and linked list data structures based on the following properties
(i) Cost of accessing and element [2 Marks]
(ii) Memory requirement [2 Marks]
(iii) Memory utilization [2 Marks]

(b) Explain TWO disadvantages of arrays over linked lists [4 Marks]


(c) Write an algorithm for deleting node 10 from the binary tree below and draw the final tree
after the deletion [6 Marks]

(d) Use division method and open addressing to store the following values: 3, 2, 9, ,11,13, 7,12
into a hash table of length 10 and hash function h(k) = k mod 10 . Show your working and
the resultant hash table [8 Marks]
(e) Specify the total number of probes used to store the values in the hash table in question (d)
[2 Marks]
(f) Discuss any TWO applications of a tree data structure [4 Marks]

As members of Kabarak University family, we purpose at all times and in all places, to set apart in one’s heart, Jesus
as Lord. (1 Peter 3:15)
Kabarak University is ISO 9001:2015 Certified
Page 2 of 5
SECTION B. TOTAL MARKS FOR THIS SECTION IS 40.
ANSWER ANY TWO QUESTIONS FROM THIS SECTION. EACH QUESTION IN THIS
SECTION CARRIES 20 MARKS.

2.
(a) The following items are to be inserted into an empty linked list in the order in which they
appear: 3, 7 , 100. Assuming that the items have been assigned memory addresses: 100, 250,
and 800 respectively.
(i) Draw a diagrammatic representation of this procedure in a double linked list
[4 Marks]
(ii) Write an implementation code for the procedure (a) in C Language [4 Marks]
(b) Consider the following tree

(i) List all the parent and child node of the following tree [2 Marks]
(ii) Determine the degree and level of the above tree [2 Marks]
(iii) Does this tree qualify to be a binary tree? [1 Mark]
(iv) Explain your answer [2 Marks]

As members of Kabarak University family, we purpose at all times and in all places, to set apart in one’s heart, Jesus
as Lord. (1 Peter 3:15)
Kabarak University is ISO 9001:2015 Certified
Page 3 of 5
(c) Use Kruskal’s algorithm to find the minimum spanning tree for this network. Draw the tree
and give its total weight [5 Marks]

3.
(a) Use the following expression: A-(C/5*2) + (D*5%4) to construct a binary expression tree.
Show your working [6 Marks]
(b) Write the pre-order and post-order traversal of the tree constructed in (a) above [4 Marks]
(c) Write a C program to dynamically initialize a single dimensional array of size n where n=5
with integer values then
(i) Display the elements of the array and their respective locations in the array
[5 Marks]
(ii) Insert item 250 at location 3 of the array and display the elements of the array
after the operation had been completed. [5 Marks]
4.
(a) State one major drawback of an ordinary queue [1 Mark]
(b) Explain how the function enqueue and dequeue operation can be modified to to resolve this
drawback stated in (a) above [2 Marks]
(c) Write the algorithms for enqueue and dequeue operations in a circular queue
[9 Marks]
(d) Insert the following keys into a B-tree of 5-way order:1 12 8 2 25 5 14 28 17 7 52 16 48 68
3 26 29 53 55 45 [8 Marks]

As members of Kabarak University family, we purpose at all times and in all places, to set apart in one’s heart, Jesus
as Lord. (1 Peter 3:15)
Kabarak University is ISO 9001:2015 Certified
Page 4 of 5
5.
(a) Describe the TWO major operations in a stack [6 Marks]
(b) Write a C program to display the Name: River in reverse order using a stack data structure
[8 Marks]
(c) Explain THREE applications of stacks [6 Marks]

As members of Kabarak University family, we purpose at all times and in all places, to set apart in one’s heart, Jesus
as Lord. (1 Peter 3:15)
Kabarak University is ISO 9001:2015 Certified
Page 5 of 5

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy