You are on page 1of 4

OUTPUT

Q1. Given an array of nonnegative integers, design a linear algorithm and


implement it using a program to find whether given key element is present
in the array or not. Also, find total number of comparisons for each input
case. (Time Complexity = O(n), where n is the size of input)

GRAPH Q1

0.000016
0.000014
0.000012
0.00001
TIME

0.000008
0.000006
0.000004
0.000002
0
1000 2000 3000 4000

NO OF ITEMS
OUTPUT
Q2. Given an already sorted array of positive integers, design an algorithm
and implement it using a program to find whether given key element is
present in the array or not. Also, find total number of comparisons for each
input case. (Time Complexity = O(logn), where n is the size of input)

GRAPH Q2

0.00002

0.000015
Time

0.00001

0.000005

0
1000 2000 3000 4000

No of Elements

You might also like