What will be the auxiliary space requirement (excluding call stack) of the program to print combinations of r elements each from array

Duyên Trương

New member
What will be the auxiliary space requirement (excluding call stack) of the program to print combinations of r elements each from array of size n?
A. O(n*r)
B. O(n/r)
C. O(n)
D. O(r)
 
Answer: D
Explanation: Code to print combinations will require an auxiliary space of O(r) other than call stack memory. This memory is required by an array that is used for storing combinations formed.
 

Tìm kiếm

Back
Top