100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Class notes CS102 Data Structures and Algorithms in C++, ISBN: 9780470383278 $7.99   Add to cart

Class notes

Class notes CS102 Data Structures and Algorithms in C++, ISBN: 9780470383278

 8 views  0 purchase
  • Course
  • Institution
  • Book

Time Complexity and Big O Notation

Preview 1 out of 3  pages

  • April 6, 2023
  • 3
  • 2022/2023
  • Class notes
  • Sir amir zia
  • All classes
avatar-seller
Time Complexity and Big O
Notation
An analogy to a real-life issue:

 This morning I wanted to eat some pizza; So, I asked my brother to get
me some from Dominos, which is 3 km away.
 He got me the pizza, and I was happy only to realize it was too little for
29 friends who came to my house for a surprise visit!
 My brother can get 2 pizzas for me on his bike, but pizza for 29 friends is
too huge of an input for him, which he cannot handle.




What is Time Complexity?
Time Complexity is the study of the efficiency of algorithms. It tells us how much
time is taken by an algorithm to process a given input. Let's understand this
concept with the help of an example:
Consider two developers Shubham and Rohan, who created an algorithm to sort
‘n’ numbers independently. When I made the program run for some input size n,
the following results were recorded:
Time Taken By Shubham’s
No. of elements (n) Time Taken By Rohan’
Algo
10 elements 90 ms 122 ms
70 elements 110 ms 124 ms
110 elements 180 ms 131 ms
1000 elements 2s 800 ms
We can see that at first, Shubham's algorithm worked well with smaller inputs;
however, as we increase the number of elements, Rohan's algorithm performs
much better.
Quick Quiz: Who’s algorithm is better?

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller ziarajput. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $7.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73918 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$7.99
  • (0)
  Add to cart