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.
Hi, I’m Vijay Chauhan, a web developer from India in love with all things internet. Online since 2015.
Subscribe to:
Post Comments (Atom)
CPU vs GPU Architecture
CPU vs GPU Architecture CPU (Central Processing Unit) and GPU (Graphics Processing Unit) have distinct architectural differences, optimize...
Best for you
-
Y 1. Understand RESTful Principles API Design pattern methods calling REST (Representational State Transfer) is an architectural style for...
-
<input type="number" > Is a default arrow by system so you need below css and you can remove arrow of the input type. its ...
-
Below Demo With Code * ** *** **** ***** let n = 5 ; let string = "" ; for ( let i = 1 ; i <= n ; i ++) { ...
-
In SQL, filtering data is essential for querying specific results from a database. Here's an explanation of how the WHERE , ORDER BY , ...
-
Classes : Fundamental building blocks used to define components, services, and models. Inheritance : Allows components/services to inherit p...
-
Answer: Performance optimization can be achieved through: Lazy Loading : Load modules only when needed. Change Detection Strategy : Use OnP...
-
DISTINCT Keyword The DISTINCT keyword is used in SQL queries to eliminate duplicate rows from the result set. It ensures that the query r...
No comments:
Post a Comment