How is O(N) algorithm also an O(N^2) algorithm? | Solution
"Upper bound" means the algorithm takes no longer than (i.e. <=) that long (as the input size tends to infinity, with relevant constant factors considered).
It does not mean it will ever actually take that long.
Something that's O(n) is also O(n log n), O(n2), O(n3), O(2n) and also anything else that's asymptotically bigger than n.
If you're comfortable with the relevant mathematics, you can also see this from the formal definition.

Subscribe to:
Post Comments (Atom)
starter ASP.NET Core Web API project with example
Starter ASP.NET Core Web API project that follows all the best practices listed above. 🛠️ Starter Project Overview We’ll build a Produc...
Best for you
-
What is PostgreSQL? PostgreSQL is an open-source relational database management system (RDBMS) emphasizing extensibility and SQL complianc...
-
1. Filter return multiple array 2. find return single return item <!DOCTYPE html> <html> <head> <meta charset="u...
-
let arr = [ 1 , 8 , 7 , 56 , 90 ]; function largest ( arr ) { let max = arr[ 0 ]; // Initialize max with the first element of the a...
-
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="...
-
In this tutorial, you will learn how to set up a Node.js and Express project with Typescript and live auto-reloading. Note that this metho...
-
Hello! For this account I plan to build and collect inspirational memes related to the anime character Rock Lee from the TV series Naruto....
-
Integrating multiple languages in an Angular application can be achieved using the @angular/localize package or by using libraries like ...
-
Starter ASP.NET Core Web API project that follows all the best practices listed above. 🛠️ Starter Project Overview We’ll build a Produc...
-
Example: A simple Spring Boot REST API Setting up Spring Boot Project: You can create a Spring Boot project using Spring Initializr: Visit:...
No comments:
Post a Comment