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

Lecture 3 - Assignments

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

Lecture 3 - Assignments

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

Homework week 3

Complexity analyses
1. Sort the following functions in the ascending order of Big O notation:

4nlogn + 2n 210 2logn

3n+100logn 4n 2n

n2 + 10n n3 nlogn

210 2logn nlogn n2+10n n3 2n


O(1) 4n 4nlogn O(n2) O(n ) O(2n)
3

3n+100logn +2n
O(n) O(nlogn)

2. Given an integer number n, your task is to write two different algorithms in


pseudo-codes to calculate 2n, and evaluate the complexity of the algorithms.
ans = 1;
for(i=0;i<n-1;i++)
ans=ans*2;

3. Your task is to write operations of queue data structure in pseudo-codes using an


array, then evaluate the complexities of the operations.
4. Your task is to write operations of queue data structure in pseudo-codes using a
linked list, then evaluate the complexities of the operations.
5. Your task is to write operations of stack data structure in pseudo-codes using an
array, then evaluate the complexities of the operations.
6. Your task is to write operations of stack data structure in pseudo-codes using a
linked list, then evaluate the complexities of the operations.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy