What is "Big O notation" and "time complexity"?
Code examples demonstrating the following complexity classes:
- O(1) - constant time (inserting elements at the beginning of a linked list)
- O(n) - linear time (summing up all elements of an array)
- O(n²) - quadratic time (sorting an array with Insertion Sort)
- O(log n) - logarithmic time (finding an element within a sorted array using binary search)
- O(n log n) - quasi-linear time (sorting an array with Quicksort)
The code belongs to this article:
- English: Big O Notation and Time Complexity – Easily Explained
- German: O-Notation und Zeitkomplexität – anschaulich erklärt
👉 Use this FREE 1-page PDF cheat sheet as a reference to quickly look up the 7 most important time complexity classes (with descriptions + examples).
➤ Hier geht's zur deutschen Version des PDFs
👉 Save time and effort with this compact overview of all new Java features from the latest version back to Java 10.
In this practical and exclusive collection, you‘ll find the most important updates of each Java version summarized on one page each.
➤ Hier geht's zur deutschen Version des PDFs
👉 Want to level up your Java skills? Sign up for the HappyCoders newsletter and get regular tips on programming, algorithms, and data structures!