Hello, I'm reading a little bit about complexity in a book about algorithms. The book says that the complexity of the algorithm is calculated by the number of operations that we do in the algorithm. Example:
We do here 3 steps(operations) to swap the values, but he still says that the algorithm is O(1) and not O(3). Why is O(1) if we still make 3 steps to get the result?Code:void swap(int *x, int *y) { int tmp = *x; *x = *y; *y = tmp; }