Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 1
Arrange the function in ascending order based on time complexity?(Questions in code as comments)
https://code.sololearn.com/ca0l2TtBuc1G/?ref=app https://code.sololearn.com/ca0l2TtBuc1G/?ref=app
1 Resposta
0
1. n^(0.5) - O(ān) : This function has polynomial time complexity, O(ān). It grows slower than linear but faster than logarithmic.
2. log4n - O(log n) : This function has logarithmic time complexity, O(log n), but with a different base. It grows slower than nlogn.
3. n - O(n) : This function has linear time complexity, O(n). It grows linearly with the input size.
4. nlog2n - O(nlogn) : This function has logarithmic time complexity, O(nlogn). It grows faster than linear but slower than quadratic.
5. nĀ² - O(nĀ²) : This function has quadratic time complexity, O(nĀ²). It grows quadratically with the input size.
6. 5^(log2n) - O(n^2.321) : This function can be simplified to n^(log2āµ), which is approximately n^2.321. It has polynomial time complexity, O(n^c), where š is a constant.
7. 1 - 3āæ - O(3āæ) : This function has exponential time complexity, O(3āæ). And n increases, the function grows rapidly.
8. 2^2n - O(2āæ)