Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
Practice Tech Mahindra Essay Topics

Cocubes Written Test Qs.(Data Structures) :: Arrays - Discussion

  • Previous
Home > Cocubes Placement Questions & Answers > MCQs Questions Discussion

55 / 138

What will be the auxiliary space complexity of the following code?

#include <iostream>
using namespace std;
int main()
{   
    int arr[] = {1,2,3,4,5,6};
    int n = sizeof(arr)/sizeof(arr[0]);
    int d=4;
    int temp[10];
 
    for(int i=0;i<d;i++)
    temp[i]=arr[i];
 
    int j=0;
    for(int i=d;i<n;i++,j++)
    arr[j]=arr[i];
 
    int k=0;
    for(int i=n-d;i<n;i++,k++)
    arr[i]=temp[k];
 
    for(int i=0;i<n;i++)
    cout<<arr[i]<<" ";
    return 0;
}

AO(n*d)

BO(1)

CO(n)

DO(d)

Answer: Option (Login/Signup)

Show Explanation

Asked In :: Capgemini Cocubes

Post Your Answer Here:     

No Discussion on this question yet!