0% found this document useful (0 votes)
6 views

Chapter1,2 Exercises

Uploaded by

mohamed fikry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Chapter1,2 Exercises

Uploaded by

mohamed fikry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Chapter#1

1. Write an algorithm to find the smallest number from amongst


three numbers.
2. Write an algorithm to find the greatest common divisor of two
numbers.
3. Write an algorithm to find the square root of a number.
4. Given an array write an algorithm to search an element from
the array.
5. Given an array write an algorithm to find the maximum element
from the array.
6. Given an array write an algorithm to find the minimum element
from the array.
7. Write an algorithm to find second maximum element from an
array.
8. Write an algorithm to sort an array.
9. Write an algorithm to find out the maximum element from a
matrix.
10. Write an algorithm to find the trace of a matrix.

Chapter#2
1. Find big Oh notation for the following:
(a) f (n) 3 n 2
(b) f (n) 3 n2 5 n 4
(c) f (n) n2 3 n 1
(d) f (n) 100 n2 91n 4000
(e) f (n) 3 n3 2 n2 5 n 2
(f) f (n) 3 n3 2198 n2 55 n 27

2. Find omega notation for the following:


(a) f (n) = 5× n + 2
(b) f (n) = 4× n2 + 3× n + 5
(c) f (n) = n2 + 237× n + 9345

3. Find theta notation for the following:


(a) f (n) 5 n 2
(b) f (n) 2 n2 4 n 3
(c) f (n) n2 7 n 9

4. Find the number of terms in the following sequences:


(i) 26, 69, …, 16767
(ii) 36, 216, …, 1679616
(iii) 0.21, 1.89, …, 111602.6
(iv) 3.124, 9.372, …, 2277.396

5. Prove the following:


(a) f (n) 5 n 2 O(n2 )

(b) f (n) 3 n3 2 n2 1n (n3 )


( c) f (n) = n2 + 237× n =Ө(n2)

6. Find the Tn term for the following APs:


(i) a 5, d 5 and n =17.
(ii) a d and n= 18

You might also like