Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

_ rs<i··,tlc: Data Su·sctures & Algorithm Babcock University

"" ·osc 00 "


,_J:: J ~L Computer Science Department
; #r,1cstcr 2016/20 I7 Ilisan-Ramo
e;/urer: Kuyoro, S PhD & Okoro Raymond
lric #: l i (,:;g"f '6 I Level: '3 \St) A
---~---~u~e:
n,crions: Care(u/1;1 read through the q.1escions ar,d clea I j'll . II Time: 60mins Marks: 30 rnark ;_
~ ~ - - ~,- . . . ry I outtheanswers. A n s w e 1 a ~
l. How does Static Array differ from Dynamic Array? . . tie below aloorit h m
,.,. . . 7 C I te the missing hnes Ill I "
,,a-" Dynamic is created automa11cally while Static ism · omp e ous data structure
- . . . anual r . 2D homogen •
b. The number of elements 1s bigger m Dynamic than S . ,or traversmg a.
. . ed . h' tatJc
·_ D)siam1c 1s creat at run lime w 1le static is at co . . 1. Repeat For I 1 to M
. . h'I S . . mp1ler lime
~ Dvnam1c 1s a new array w I e talic 1s old 2. Repeat For J = l to N 1'
c. N~ne'of the above 3. A- tte-S5 ,V/l.~

2. g . refers
.
to the capacity of resou
.
..
rces utihzed b 4_ [End of Step 2 For Loop]
an algorithm m solving a problem Y
"t{fif' Complexity ofa~ algorithm s. [End of Step l For Loop]
b. Ranks ofan array 6. gy: 1,11
c. Abstract Data Types 8. Worst Case Comple,xity occ~rs in Bubble Sort
d. Axioms of ADT
e. Type Systems ,, when we require ~ '
a., fq) =n-'1 comparisons
3. ln order to denote an individual compon t f
. en o a baset;ype,
the name qr entire structure is denoted by a J:::, V Y. f(n) = n+ 1 comparisons
, )1· Method -- c. f(n) = n comparisons
),::' index d, f(n) = n comparisons
2
c. Abstra~t Data Type
d. Sorting value
e. , f(n) = 0 comparisons
e. R. .n dom access 0 CP.s ~ t,ll\1'r?sthe function defined by
maximum number ofst.eps takei1,on any instance of
4. In Array of size n where K determines the location ofan size 'n'.
item, overflow error occu_rs d ~:i ng Operation:lnsert ()
when , C- 1U. If the op t" mai soiution takes k units ,~hiie 01~~
algo rithm takes something less than x*k this is
~- k,sn
/ b. k<n ,
V c~lle(!_ ~ \ ~ l ! l r l tq\-
jn1.Q.<lj' algnri•l,rn
v y k> n
I 20M arks
d. k;:: O
e. None of the above I 1. LA i_s an array holding unsorted CGPAs for selected
Onon Graduating Class students
5. Which of the below denotation gives the upper bound or a LA lii-LAr,,J [5.0, 3. 4, 45;5:O, 3.2, SJ);}
function
a. 0 (g(n)) = { f(n): iffthere exi sts positive constants cl , c2 and no You arc required to show:
such that O :S ci g(11) :S l{ n) :S c2 g(n) for all n >110 )
b !:1(1;( n)j = { f(n) · i,llthere ex ists r ositivc C0nstan t c and n,, such th at i. The Permutation of LA [·i-1 A·10] w h ere ynur
,
/O'.'. cg(11 ) :S f(n)fora ll11 >nu } postcondition is r~prese nted as b 1- b'n such
V JC' O(g(n)) the set of functions O(g(n)) = { l(n): there exis1s positive that b1 :,; b2 .. .bn in a Worst-Case RT re' quires
constant c and no such 1hat O:S f(n) :S cg(n) for all n > no ) . .

d. N(g(n)) th e set of function s O(i(n)) = { f(n): there exists positive f(n) = n+ l comparisons. Hint: Use Bubble
constant c and no such that O :S f(n) :S cg(n) for all > no } n: Sort ()
ii. That th e Average Ca se R
e. None of th e above unni ng Tim e will
require 1/(n) =n+l / 2
compa.ris ons. Stat,,
/ d\ D r\~rfl_ _
is a mathematic~! yo ur algorithm clea rly
Ir
"
6
-
proces s tn a
f -~ le easy-to- impleme nt solutions
ooks or si mp ' . . iii. th S
e iz,, of LI, where a1 . .. a .
. blems by 11ecid1ng which next 11 1s Ste-red from
tn c1,mple>,., mulu-step pro LA [JS J- LA [n}
t obvic,11s hcnefit. iv.
ste p will p,0 vide the mos · How to get th
e second largest CGPA

You might also like