hi frndz...
here's a very small doubt that's been lingering for a while...

what is the meaning of finding an algorithm for a certain problem in constant space??
i dont understand the meaning of constant space, does it mean that no temporary variable can be created?

for ex:here's a question...

given an array- arr[6]={1,2,3,4,5,6}, i want to rotate the array from index k=3 in such a manner that it becomes-- arr[6]={3,4,5,6,1,2}

now this has to be done in constant space & time complexity of O(n)
so kindly reply...
Thanx..

Constant space doesn't necessarily mean no temporary values, it just means that as the function scales (IE, your array grows to 7,8,9,etc values), that more space is not used.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.