



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An examination paper for the applied data structures module (comp6012) at the cork institute of technology. The paper includes instructions for candidates, questions on topics such as dynamic memory allocation, linked lists, array sorting, binary trees, and recursive functions. Questions require candidates to write code and provide diagrams.
Typology: Exams
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Semester 2 Examinations 2010/
Module Code: COMP
School: School of Science
Programme Title: Higher Certificate in Science in Computing Bachelor of Science (Honours) in Software Development Bachelor of Science in Computing
Programme Code: KCOME_6_Y KSDEV_8_Y KCOMP_7_Y
External Examiner(s): Mr. Peter Given Internal Examiner(s): Mr. Eoin O’Regan Mr. Karl O’Connell
Instructions: Answer Question 1 and any TWO other Questions.
Show all work.
Duration: 2 hours
Sitting: Autumn 2011
Requirements for this examination:
Note to Candidates: Please check the Programme Title and the Module Title to ensure that you have received the correct examination paper. If in doubt please contact an Invigilator.
Question 1 – Compulsory Question
a. Compare and contrast how Dynamic Memory Allocation is used in linked lists as distinct from Dynamic Arrays. [ 5 Marks]
b. Describe how i. A new node is added to an ordered linked list that already has nodes in it ii. An existing node is deleted from a linked list
Use both a memory diagram & a diagram showing the node & the pointer to help in illustrating the answer [ 10 Marks]
c. Data to be stored in a node of a linked list should include the following data on route information for flights Route id Departure Destination Aeroplane Seating Price per Adult
Write the code to i. Create the struct that will contain the record info & be used in the linked list as a node. [ 4 Marks] ii. Create a pointer called head in the main program that is initialised to indicate that there is an empty list. [ 1 Mark]
d.
Write a function for saving the list of flights to a file, emptying it in the process. [ 7 marks]
e. Write the function to search through the linked list of route information for flights with the search based on the Route id. [ 8 marks]
f. Write the function for deleting a booking from a list in order of flight id ( delete a node function ). [ 5 marks]
Question 3.
a. What rules apply when searching a Binary Tree? [4 Marks]
b. Explain the difference between the Root Node and the Leaf Node in terms of trees. [4 Marks]
c. Define what a tree structure is. [2 Marks]
d. Given the following BTree structure draw the resulting structure once the key value 37 has been deleted.
[10 Marks]
e. Given an empty BTree structure insert the following key values and draw the resulting BTree Structure. root : NULL
Key Values = 37, 2, 45, 48, 41, 29, 20, 30, 49, 7 [10 Marks]
Question 4.
a. Explain what is meant by the term Recursive Function. [2 Marks]
b. A power() function is often written as a recursive function Write a C++ function that returns the power of a given number passed to the function.
Example: power(2,3) power(2,2)* power(2,1)* power(2,0)* 1
[10 Marks]
c. What does infinite recursion mean? [2 Marks]
d. Explain the meaning of the following queue operations i. ENQUEUE ii. DEQUEUE iii. PEEK [3 Marks]
e. Outline what the data structures Stack and Queue are and the reasons for using one over the other. [3 Marks]
f. The main operations that are performed on a Circular Queue are: Initialise the Queue Insert an element into the Queue Remove an element from the Queue.
Explain the steps involved in: i. Initialise the Queue [2 Marks]
ii. Inserting an element into the Queue [4 Marks]
iii. Removing an element from the Queue [4 Marks]