


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Answer Question 1 and THREE other questions. All questions carry equal %.
Examiners: Mr. D. O’Donovan Dr. S. Foley Prof. W. Hurley
city area. The system requires the entry from the keyboard of the:
model
make registration number
as the cars pass an observation point.
Using a linked-list approach, define a C language data structure capable of storing the above information. [4 %]
(b) Write a function which will add an entry to the linked list. [8 %] (c) Determine the number of Volvo cars which passed the observation point. [6 %]
(d) Delete the list. [7 %]
C Name Address in Memory y (^) 0xFFFFA h 0xFFFFA Value returned from malloc 0xFFEBFC Table 3- (i) Using memory diagrams, in conjunction with the addresses supplied in Table 3- illustrate the variable assignments that occur in the above program. [7 %] (ii) Why is the double star i.e. ‘**’ notation required? [3 %]
(d) Using the unsorted sequence, A={2, 8, 5, 9, 3}, illustrate the operation of the Insertion Sort pseudocode supplied paying particular attention to the array, A , indexes (1- length[A]) Insertion Sort (A) for j ← 2 to length[A] do key ← A[j] i ← j- while i>0 and A[i] >key do A[i+1] ← A[i] i ← i- A[i+1] ← key [5 %]
AND use it to illustrate the attributes discussed in (a). [4 %]
(c) The merge sort algorithm is an example of a recursive sort algorithm. Write a C program to implement the merge sort algorithm. [18 %]
computer. [5 %]
(b) Write a C program to implement the Newton-Raphson method for solving non-linear
(c) Describe the Bisection method for solving non-linear equations. [5 %]
(d) Compare the Bisection and the Newton-Raphson methods for solving non-linear equations. [3 %]