CoderSathi
  • Tutorial
    • Java Tutorial
    • Swing Tutorial
    • JDBC Tutorial
    • Java String Tutorial
    • Servlet and JSP Tutorial
  • Mongo DB
  • AWS
  • DevOps
  • Linux
  • Git
Home > What is > Order of growth of an Algorithm

Order of growth of an Algorithm

Learn the concepts, implementation details, and practical steps with a clean developer-focused walkthrough.

Yuba Raj Kalathoki
By Yuba Raj Kalathoki
Published: September 19, 2021 Β· 2 min read Β· 0 Comments
Share: X in πŸ”—

Overview

Order of growth of an algorithm is a way of predicting how long is the execution time of a program and the space/memory is required when the input size changes. We can have multiple solutions and need to determine the most efficient one to use.

For this purpose: we need to figure out which solutions are more efficient by identifying the time taken by all the solutions that are implemented, we write a polynomial (the worst case scenario) and then we see the order of growth of every time taken and which one has the least order of growth.

When we identify that the solution which has the least order of growth then we can say this algorithm is efficient.

The function can have:

  • Least order of growth and
  • Higher order of growth

A function f(n) is said to be growing faster i.e. higher order than g(n) if:

order of growth1

So if f(n) is growing faster i.e. having more order of growth then the algorithm whose time taken is represented by a function f(n) is a bad algorithm. This means an algorithm represented by function g(n) is better because it’s growing slower in terms of input size.

For example:

A function is f(n) is said to be growing faster than g(n) if: order of growth 2

order of growth 3
order of growth 4

Easiest way to find and compare growths:

  1. Ignore lower order terms
  2. Ignore leading term constant

For example:

f(n) =2n2 + n + 6, order of growth: n2 (quadratic)

g(n) = 200n + 5, order of growth: n (linear)

Now if there is multiple terms and conditions then how we decide which one is leading, which one is not leading, which one is growing slower for that we can always use the basic mathematics terms like:

c < loglogn < logn  <  n1/3  <  n1/2  <  n  <  n2  <  n3  <  n4  <  2n  <  nn

That means: c grow very slowly, then loglogn and so on.

Following is the some exercise:

First,

order of growth 5

Since, the order of growth of g(n) is higher than f(n) hence g(n) is considered a bad algorithm.

Second,

order of growth 6

Since, the order of growth of f(n) is higher than g(n). Hence, f(n) is considered a bad algorithm. 

Conclusion

In this post, we learn how we can determine the order of growth of a function so that we can analyze the best, average and worst case scenario during the analysis of an algorithm..

Related Posts:

  • java.lang.Long Class in Java
  • Control Statements in Java
  • Best Average and Worst cases in algorithm analysis
  • Compile and Run Java Program
  • Load Balancing
  • What is JVM (Java Virtual Machine)? Architecture,…
Tags:algorithmdsa
Was this article helpful?
← Previous ArticleAsymptotic Analysis
Next Article β†’Best Average and Worst cases in algorithm analysis

Leave a Comment Cancel reply

You must be logged in to post a comment.

Recent Posts

  • How to Use AWS CloudFront Signed URLs in Spring Boot?
  • How to Fix SSH Agent Forwarding on macOS: The Ultimate Guide for Developers
  • How to Read AWS Secrets Manager in Spring Boot (Step-by-Step)
  • How to Fix “Public Key Retrieval is not allowed” MySQL JDBC Error
  • Complete Guide to JaCoCo: How to Measure Java Code Coverage Accurately
CoderSathi

Your go-to resource for Java, Spring Boot, Microservices, AWS, and modern development tutorials.

Quick Links

  • About
  • Contact

Popular Topics

  • Java
  • Spring Boot
  • AWS
  • DevOps
  • MongoDB
  • Linux
  • Git
  • How to
Β© 2026 CoderSathi. All rights reserved. Privacy Policy Β· Sitemap