This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| +--------------------+-----------------+-----------------------------------------+ | |
| | |space complexity | time complexity | | |
| | Sorting Algorithms +-----------------+------------+--------------+-------------+ | |
| | | worst case | best case | average case | worst case | | |
| +--------------------+-----------------+------------+--------------+-------------+ | |
| | Bubble Sort | O(1) | O(n) | O(n2) | O(n2) | | |
| +--------------------+-----------------+------------+--------------+-------------+ | |
| | Heapsort | O(1) | O(n log n) | O(n log n) | O(n log n) | | |
| +--------------------+-----------------+------------+--------------+-------------+ | |
| | Insertion Sort | O(1) | O(n) | O(n2) | O(n2) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| +-------------------------------------------------------------------------------------+ | |
| | growth-rates | | |
| +---------------+---------+---------+----------+------------+-----------+-------------+ | |
| | n f(n) | log n | n | n log n | n2 | 2n | n! | | |
| +---------------+---------+---------+----------+------------+-----------+-------------+ | |
| | 10 | 0.003ns | 0.01ns | 0.033ns | 0.1ns | 1ns | 3.65ms | | |
| +---------------+---------+---------+----------+------------+-----------+-------------+ | |
| | 20 | 0.004ns | 0.02ns | 0.086ns | 0.4ns | 1ms | 77years | | |
| +---------------+---------+---------+----------+------------+-----------+-------------+ | |
| | 30 | 0.005ns | 0.03ns | 0.147ns | 0.9ns | 1sec | 8.4x1015yrs | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| +----------------------------+--------------------------------+--------------------------------+ | |
| | | Average case | Worst case | | |
| | Data Structures +----------+----------+----------+----------+----------+----------+ | |
| | | Search | Insert | Delete | Search | Insert | Delete | | |
| +----------------------------+----------+----------+----------+----------+----------+----------+ | |
| | Array | O(n) | N/A | N/A | O(n) | N/A | N/A | | |
| +----------------------------+----------+----------+----------+----------+----------+----------+ | |
| | AVL Tree | O(log n) | O(log n) | O(log n) | O(log n) | O(log n) | O(log n) | | |
| +----------------------------+----------+----------+----------+----------+----------+----------+ | |
| | B-Tree | O(log n) | O(log n) | O(log n) | O(log n) | O(log n) | O(log n) | |