Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Efficient Algorithm Design

You're reading from   Efficient Algorithm Design Unlock the power of algorithms to optimize computer programming

Arrow left icon
Product type Paperback
Published in Oct 2024
Publisher Packt
ISBN-13 9781835886823
Length 360 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Masoud Makrehchi Masoud Makrehchi
Author Profile Icon Masoud Makrehchi
Masoud Makrehchi
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Part 1: Foundations of Algorithm Analysis
2. Chapter 1: Introduction to Algorithm Analysis FREE CHAPTER 3. Chapter 2: Mathematical Induction and Loop Invariant for Algorithm Correctness 4. Chapter 3: Rate of Growth for Complexity Analysis 5. Chapter 4: Recursion and Recurrence Functions 6. Chapter 5: Solving Recurrence Functions 7. Part 2: Deep Dive in Algorithms
8. Chapter 6: Sorting Algorithms 9. Chapter 7: Search Algorithms 10. Chapter 8: Symbiotic Relationship between Sort and Search 11. Chapter 9: Randomized Algorithms 12. Chapter 10: Dynamic Programming 13. Part 3: Fundamental Data Structures
14. Chapter 11: Landscape of Data Structures 15. Chapter 12: Linear Data Structures 16. Chapter 13: Non-Linear Data Structures 17. Part 4: Next Steps
18. Chapter 14: Tomorrow’s Algorithms 19. Index 20. Other Books You May Enjoy

Asymptotic notations

Asymptotic notation is a mathematical framework used to describe the behavior of algorithms in terms of their time and space complexities as the input size approaches infinity. It classifies algorithms according to their growth rates, allowing for the comparison of efficiency across different algorithms independently of hardware or implementation details. Adapted from the field of mathematical analysis, asymptotic notation describes the limiting behavior of mathematical functions. As its name suggests, asymptotic notation does not provide specific solutions but rather a formal representation of the behavior of functions as they scale.

Let’s assume we have a function like the following:

<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" display="block"><mml:mi>f</mml:mi><mml:mfenced separators="|"><mml:mrow><mml:mi>n</mml:mi></mml:mrow></mml:mfenced><mml:mo>=</mml:mo><mml:mi> </mml:mi><mml:msup><mml:mrow><mml:mi>n</mml:mi></mml:mrow><mml:mrow><mml:mn>3</mml:mn></mml:mrow></mml:msup><mml:mo>+</mml:mo><mml:mi> </mml:mi><mml:mn>1000</mml:mn><mml:msup><mml:mrow><mml:mi>n</mml:mi></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:msup><mml:mo>+</mml:mo><mml:mi> </mml:mi><mml:mn>6</mml:mn><mml:mi>n</mml:mi><mml:mi> </mml:mi><mml:mo>+</mml:mo><mml:mi> </mml:mi><mml:mn>5</mml:mn><mml:mi> </mml:mi><mml:mo>×</mml:mo><mml:msup><mml:mrow><mml:mn>10</mml:mn></mml:mrow><mml:mrow><mml:mn>5</mml:mn></mml:mrow></mml:msup></mml:math>

We want to predict the behavior of <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>f</mml:mi><mml:mfenced separators="|"><mml:mrow><mml:mi>n</mml:mi></mml:mrow></mml:mfenced></mml:math> as <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>n</mml:mi><mml:mo>→</mml:mo><mml:mi>∞</mml:mi></mml:math>. Although the term <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mn>1000</mml:mn><mml:msup><mml:mrow><mml:mi>n</mml:mi></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:msup></mml:math> has a very large coefficient and there is a large constant <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mn>5</mml:mn><mml:mo>×</mml:mo><mml:msup><mml:mrow><mml:mn>10</mml:mn></mml:mrow><mml:mrow><mml:mn>5</mml:mn></mml:mrow></mml:msup></mml:math>, all terms except <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:msup><mml:mrow><mml:mi>n</mml:mi></mml:mrow><mml:mrow><mml:mn>3</mml:mn></mml:mrow></mml:msup></mml:math> become insignificant when<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mrow><mspace width="0.25em" /><mi>n</mi></mrow></mrow></math>grows very large. In mathematical analysis, we symbolically write<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mrow><mi mathvariant="normal"></mi><mi>f</mi><mfenced open="(" close=")"><mi>n</mi></mfenced><mo>∼</mo><msup><mi>n</mi><mn>3</mn></msup></mrow></mrow></math> and read it as “<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>f</mml:mi><mml:mfenced separators="|"><mml:mrow><mml:mi>n</mml:mi></mml:mrow></mml:mfenced></mml:math> is asymptotically...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image