What Is The Space Complexity when There Are Two Variables in a Program?

You have a program with two (or three) variables, but no other data structures. What is the space complexity?

O(1). An algorithm, as long as the number of variables is fixed, can have 1,000 variables and be said to have O(1) space complexity. The source is here:


Leave a comment

Your email address will not be published. Required fields are marked *