Examination Paper: Applied Data Structures (COMP6012) - Cork Institute of Technology, Exams of Data Structures and Algorithms

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

2012/2013

Uploaded on 03/24/2013

bakula
bakula 🇮🇳

4.4

(5)

35 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CORK INSTITUTE OF TECHNOLOGY
INSTITIÚID TEICNEOLAÍOCHTA CHORCAÍ
Semester 2 Examinations 2010/11
Module Title: Applied Data Structures
Module Code: COMP6012
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_Y2
KSDEV_8_Y1
KCOMP_7_Y1
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.
pf3
pf4
pf5

Partial preview of the text

Download Examination Paper: Applied Data Structures (COMP6012) - Cork Institute of Technology and more Exams Data Structures and Algorithms in PDF only on Docsity!

CORK INSTITUTE OF TECHNOLOGY

INSTITIÚID TEICNEOLAÍOCHTA CHORCAÍ

Semester 2 Examinations 2010/

Module Title: Applied Data Structures

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]