Home / MCQ Bank / Computer
Computer Arrays In Data Structures

What will be the time 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; }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option B • O(n)

Related Computer Questions

What method is used to find the elements that are present in either of the sets, but not in both sets? Which of the following is not a combinatory? What will be the output of the following C code? #include <stdio.h> int main() { int i = 0; int x = i++, y = ++i; printf("%d % d\n", x, y); return 0; } ______ is the subset of the replicas list that is currently alive and caught up to the leader. The process of pickling in Python includes ______