Skip to content
Snippets Groups Projects
Commit bce19ef9 authored by Dominik Zobel's avatar Dominik Zobel Committed by Tobias Koelling
Browse files

Add selection of time complexities

parent ca8273c3
No related branches found
No related tags found
1 merge request!24complexity lecture
...@@ -15,7 +15,7 @@ Amount of resources needed for algorithms working on data structures ...@@ -15,7 +15,7 @@ Amount of resources needed for algorithms working on data structures
- Time to run an algorithm with given data size - Time to run an algorithm with given data size
- Often main focus of complexity analysis - Often main focus of complexity analysis
**Space Complexity** **Space Complexity**
- Memory required to run an algorithm with given data size - Memory required to run an algorithm with given data size
...@@ -34,6 +34,22 @@ Amount of resources needed for algorithms working on data structures ...@@ -34,6 +34,22 @@ Amount of resources needed for algorithms working on data structures
| quadratic | $\mathcal{O}(n^2)$ | | quadratic | $\mathcal{O}(n^2)$ |
## Selection of Time Complexities
:::{.smaller}
Data structure Access Insert/Delete Search
--------------- ----------------------- ------------------------------------- -------------------------------------
Array $\mathcal{O}(1)$ $\mathcal{O}(n)$ $\mathcal{O}(n)$
Linked list $\mathcal{O}(n)$ $\mathcal{O}(1)$ $\mathcal{O}(n)$
Hash table --- $\mathcal{O}(1)$ -- $\mathcal{O}(n)$ $\mathcal{O}(1)$ -- $\mathcal{O}(n)$
Tree[^1] $\mathcal{O}(\log{n})$ $\mathcal{O}(\log{n})$ $\mathcal{O}(\log{n})$
[^1]: Some types of trees have $\mathcal{O}(\log{n})$ -- $\mathcal{O}(n)$ for insert/delete and search
:::
# specific algorithms # specific algorithms
* sorting (e.g. bubble, quick, merge, bogo... [idea instructions](https://idea-instructions.com)) * sorting (e.g. bubble, quick, merge, bogo... [idea instructions](https://idea-instructions.com))
...@@ -41,11 +57,6 @@ Amount of resources needed for algorithms working on data structures ...@@ -41,11 +57,6 @@ Amount of resources needed for algorithms working on data structures
* bisect (?) (ref to `git bisect`) * bisect (?) (ref to `git bisect`)
## Revisiting arrays and linked-lists
- Access time
- Searching
# models of computation # models of computation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment