15 - SampleExam

15 - SampleExam - GRIFFITH COLLEGE DUBLIN NATIONAL COUNCIL...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
GRIFFITH COLLEGE DUBLIN NATIONAL COUNCIL FOR EDUCATIONAL AWARDS SAMPLE EXAM GRADUATE DIPLOMA IN COMPUTING SCIENCE SAMPLE SAMPLE SAMPLE Programming and Data Structures Lecturer : Thanh Giang THIS PAPER CONSISTS OF SIX QUESTIONS. SECTION A – COMPULSORY SECTION B – FOUR QUESTIONS TO BE ATTEMPTED
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
SECTION A – COMPULSORY Question 1 (a) Describe a non- linear data structure. Give examples and operations in which you might perform on such a structure. (4 marks) (b) Briefly describe the difference between the Dynamic Programming and the Greedy solution paradigm. Give an example of a problem that may use a Dynamic Programming approach and one that may use a Greedy approach. (4 marks) (c) What is recursion and why is the concept important in computer science? Demonstrate your understanding of recursion by giving a recursive algorithm for finding the factorial of a number n. Reminder : The factorial of a number n (i.e. n!) is the solution to the product : n*(n-1)*(n-2)*….*3*2*1 Expressed mathematically : n! = (4 marks) (d) Describe pre-order traversal of a binary search tree. Show the output of a pre- order traversal of the following binary search tree. (4 marks) 1 if n = 0 n*(n-1)! If n > 0 <14> <7> <16> <6> <9> <15> <21> <23>
Background image of page 2
(e) In complexity theory what do we mean when we say a class of problem is P? What do we mean when we say a class of problem is NP? Give an example of
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/25/2010 for the course CPE CPE 360 taught by Professor Jenniferchen during the Spring '10 term at Stevens.

Page1 / 6

15 - SampleExam - GRIFFITH COLLEGE DUBLIN NATIONAL COUNCIL...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online