I have someone homework to make and in the instructions it says that we need to implement a function in O(1).
Now, does it mean that I can make my function in O(5) or O(2) or whatever?
2
Yes, O(5) is the same thing as O(1). If you’ve been asked to implement a function in O(1) time, it means it needs to run in the same amount of time no matter how large the data being provided to it is.