问题
Ok so I came across a question and I am confused about its answer. I have to find the time complexity of the algorithm. The algorithm says that I have an array of size n and on each element of the array 5 operations are to be performed. So I came up with the following answer that I have to perform 5*n operations in total on it right? so it's time complexity would be of the order n?
回答1:
Yes.
If the time required for each operation is constant.
But also depends on what the operations are.
来源:https://stackoverflow.com/questions/28523398/time-compexity-of-algorithms