/AlgorithmAndDataStructure

Algorithm and Data Structure study

Primary LanguagePython

AlgorithmAndDataStructure

Computing complexity with Big-O notation

Task Big-$O$
Task0.py $O(1)$ consistennt as independento of the size
Task1.py $O(n)$ Linear as it goes through both lists in the for loop, and not go through any lists in it.
Task2.py $O(n)$ Liniear as it goes through the calls, and not go through any lists in it.
Task3.py $O(n\log n)$ It goes list twice, first in for loop, and second in converting list to set. But after that, it runs sorting, which contributes most to computation, $n\log n$.
Task4.py $O(n\log n)$ It goes list twice, first in for loop, and second in converting list to set. But after that, it runs sorting, which contributes most to computation, $n\log n$.