wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Algorithm Analysis (JT Class 6 Dec 2025)

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.

Consider the singly linked list that consists of 100 nodes and determine the time complexity to identify the occurrence of the second prime number in the list.

a)

O(n^2)

b)

O(n)

c)

O(n sqrt(n) )

d)

O(n log n)

2.

The following keys 40,20,60,10,30,25 are inserted into an empty AVL tree. Determine the complexity of searching for node 30 after insertion.

a)

O(n)

b)

O(1)

c)

O(log n)

d)

O(n log n)

3.

If the numbers from 1 to 100 are inserted into a Binary Search Tree randomly, determine the average complexity of searching for any node in the last level of the tree.

a)

O(log n)

b)

O(n)

c)

O(1)

d)

O(n log n)

4.

Insert the key elements 1, 3, 5, 6, 7, 8, 9, 10 into a min-heap and determine the complexity to build the heap.

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n log n)

5.

Sort the numbers 11, 2, 4, 6, 16, 13, 17, 18, 19, 22 in ascending order using Insertion Sort and determine the complexity only for Pass 8.

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n log n)

6.

Determine the least complexity to sort the numbers 11, 2, 3, 5, 6, 9, 8, 7 in ascending order

a)

O(1)

b)

O(log n)

c)

O(n)

d)

O(n log n)

7.

Consider the data 12,13,17,18,19,20,22,24,26,25 stored inside separate chaining using the hash function h(k) = k%TS, where TS = 10. Determine the average case complexity of searching for an element 24.

a)

O(1+λ)

b)

O(λ)

c)

O(n+λ)

d)

O(1)

8.

Determine the time complexity on calling a function B(n)

int B(double n)

{

if (n <= 1)

return 0;

else return 1 + B(log(n) );

}

a)

O(log n)

b)

O(log log n)

c)

O(n log n)

d)

O(sqrt(n) log n)

9.

Determine the time complexity of the code

for(i = 1; i <= n; i++)

for(j = 1; j <= i*i; j++)

if(j % i == 0)

printf("*");

a)

O(n^2)

b)

O(n)

c)

O(n sqrt(n) )

d)

O(n log n)

10.

If the STACK ADT is implemented using a singly linked list, determine the time complexity to check the peek element

a)

O(1)

b)

O(n)

c)

O(n^2)

d)

O(log n)