1

This question already has an answer here:

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?

marked as duplicate by gnat, Bart van Ingen Schenau, Blrfl, Doc Brown, user22815 Apr 25 '16 at 22:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    There isn't enough information in your question to make it answerable. I don't even know why you would need to know this to do your homework. – Robert Harvey Apr 25 '16 at 16:23
  • You have someone's homework to make? Or some homework? – Doc Brown Apr 25 '16 at 20:53
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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.