81. In special case, the time complexity of inserting/deleting elements at the end of dynamic array is . . . . . . . .
82. Suffix array can be created by performing . . . . . . . . traversal of a suffix tree.
83. If comparison based sorting algorithm is used construct the suffix array, then what will be time required to construct the suffix array?
84. Which of the following is/are advantages suffix array one suffix tree?
I. Lesser space requirement
II. Improved cache locality
III. Easy construction in linear time
I. Lesser space requirement
II. Improved cache locality
III. Easy construction in linear time
85. Which of the following bitwise operations will you use to toggle a particular bit?
86. What will be the time complexity of the following code?
#include <bits/stdc++.h>
using namespace std;
void func(int arr[], int left, int right)
{
if (left >= right)
return;
int temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
func(arr, left + 1, right - 1);
}
void printArray(int arr[], int size)
{
for (int i = 0; i < size; i++)
cout << arr[i] << " ";
}
int main()
{
int arr[] = {1,2,3,4};
int n = sizeof(arr) / sizeof(arr[0]);
func(arr, 0, n-1);
printArray(arr, n);
return 0;
}
#include <bits/stdc++.h>
using namespace std;
void func(int arr[], int left, int right)
{
if (left >= right)
return;
int temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
func(arr, left + 1, right - 1);
}
void printArray(int arr[], int size)
{
for (int i = 0; i < size; i++)
cout << arr[i] << " ";
}
int main()
{
int arr[] = {1,2,3,4};
int n = sizeof(arr) / sizeof(arr[0]);
func(arr, 0, n-1);
printArray(arr, n);
return 0;
}87. Choose the appropriate code that counts the number of non-zero(non-null) elements in the sparse array.
88. Which of the following is a disadvantage of dynamic arrays?
89. What will be the auxiliary space requirement of the following code?
#include <bits/stdc++.h>
using namespace std;
void func(int arr[], int left, int right)
{
while (left < right)
{
int temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
left++;
right--;
}
}
void printArray(int arr[], int size)
{
for (int i = 0; i < size; i++)
cout << arr[i] << " ";
}
int main()
{
int arr[] = {1,4,3,5};
int n = sizeof(arr) / sizeof(arr[0]);
func(arr, 0, n-1);
printArray(arr, n);
return 0;
}
#include <bits/stdc++.h>
using namespace std;
void func(int arr[], int left, int right)
{
while (left < right)
{
int temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
left++;
right--;
}
}
void printArray(int arr[], int size)
{
for (int i = 0; i < size; i++)
cout << arr[i] << " ";
}
int main()
{
int arr[] = {1,4,3,5};
int n = sizeof(arr) / sizeof(arr[0]);
func(arr, 0, n-1);
printArray(arr, n);
return 0;
}90. Which of the following is/are not applications of bit arrays?
Read More Section(Arrays in Data Structures)
Each Section contains maximum 100 MCQs question on Arrays in Data Structures. To get more questions visit other sections.
