Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

What is the minimum possible time complexity to find the number of steps to reach the end of an array?(a) O(n)(b) O(n^2)(c) O(n^3/2)(d) O(1)My question comes from Number of Jumps to Reach End-array Operation topic in chapter Arrays Types of Data Structures & Algorithms II have been asked this question during an interview.

Answer» RIGHT choice is (a) O(n)

Easy explanation - The MINIMUM POSSIBLE time complexity to REACH the end of an ARRAY is O(n). So a linear time complexity is possible.
2.

: It is not possible to reach the end of an array if starting element of the array is 0.(a) true(b) falseMy question is taken from Number of Jumps to Reach End-array Operation topic in division Arrays Types of Data Structures & Algorithms IThis question was posed to me by my college professor while I was bunking the class.

Answer»

Right option is (a) true

The best EXPLANATION: If the first element of an array is 0 then it is not POSSIBLE to reach the END. HOWEVER, if 0 is present at other POSITIONS then we may/may not be able to reach the end.

3.

In how many different ways we can reach the end of the array arr[]={1,3,5,8,9}?(a) 1(b) 2(c) 3(d) 4Asked question is from Number of Jumps to Reach End-array Operation topic in portion Arrays Types of Data Structures & Algorithms IThe question was asked in homework.

Answer»

The CORRECT answer is (d) 4

The best I can explain: There are 4 possible ways in which we can REACH the END of the array. The possible paths are – 1->3->5->8->9, 1->3->5->9, 1->3->8->9, 1->3->9.

4.

It is not possible to find the minimum number of steps to reach the end of an array in linear time.(a) true(b) falseI'm obligated to ask this question of Number of Jumps to Reach End-array Operation topic in portion Arrays Types of Data Structures & Algorithms IThis question was posed to me by my school teacher while I was bunking the class.

Answer»

Right answer is (B) false

Easy EXPLANATION - It is possible to find the minimum number of steps to REACH the end of an ARRAY in O(N) time complexity. So it is the fastest possible method of finding the minimum number of steps to reach the end of an array.

5.

What will be the minimum number of jumps required to reach the end of the array arr[] = {1,2,0,0,3,6,8,5}?(a) 1(b) 2(c) 3(d) not possible to reach the endAsked question is from Number of Jumps to Reach End-array Operation topic in division Arrays Types of Data Structures & Algorithms IThe question was posed to me in an interview for job.

Answer»

Correct answer is (d) not possible to reach the END

Best explanation: Each element of the ARRAY represents the maximum NUMBER of steps that can be taken forward from that element. So we cannot move any further after reaching the second element HENCE it is impossible to reach the end of the array.

6.

What will be the minimum number of jumps required to reach the end of the array arr[] ={0,1,3,6,3,6,8,5}?(a) 1(b) 2(c) 3(d) not possible to reach the endThe above asked question is from Number of Jumps to Reach End-array Operation in chapter Arrays Types of Data Structures & Algorithms IThis question was posed to me in an interview for internship.

Answer»

Right ANSWER is (d) not possible to reach the end

Easy explanation - Each ELEMENT of the array REPRESENTS the maximum number of STEPS that can be taken forward from that element. So as the first element here is 0 so we cannot MOVE any further from the first element. Thus, it is not possible to reach the end of the array.

7.

What will be the minimum number of jumps required to reach the end of the array arr[] = {1,3,6,3,6,8,5}?(a) 1(b) 2(c) 3(d) not possible to reach the endThis is a very interesting question from Number of Jumps to Reach End-array Operation in portion Arrays Types of Data Structures & Algorithms IThis question was posed to me in an internship interview.

Answer» RIGHT option is (c) 3

To explain: Each element of the array represents the maximum NUMBER of STEPS that can be taken forward from that element. If the first element is 0 then it is not possible to reach the END.
8.

Predefined function reverse() in C++ is available under which header file?(a) math(b) stdio(c) stdlib(d) algorithmThis intriguing question comes from Arrays Types topic in chapter Arrays Types of Data Structures & Algorithms IThe question was posed to me by my school principal while I was bunking the class.

Answer»

Right answer is (d) ALGORITHM

Explanation: The predefined function for reversing an array is reverse() in C++ which comes under the library called an algorithm. It requires 2 ARGUMENTS the first being the POINTER to the STARTING INDEX of the array and the second being the pointer to the last index of the array.

9.

Which of the following is the predefined function for array reversal in javascript?(a) reverse()(b) arr_reverse()(c) array_reverse()(d) rev()This interesting question is from Arrays Types topic in chapter Arrays Types of Data Structures & Algorithms II got this question in final exam.

Answer»

Right answer is (a) REVERSE()

EASY EXPLANATION - The predefined function for REVERSING an array is reverse() in javascript. It does not requires any argument.

10.

Which of the following is the predefined function for array reversal in C++ ?(a) reverse()(b) arr_reverse()(c) array_reverse()(d) rev()My question is from Arrays Types topic in division Arrays Types of Data Structures & Algorithms II had been asked this question in semester exam.

Answer»

Right option is (a) reverse()

For EXPLANATION: The PREDEFINED FUNCTION for reversing an array is reverse() in C++. It is defined under the library ALGORITHM and requires 2 arguments.

11.

When array reversal and rotation is applied to the same array then the output produced will also be the same every time.(a) true(b) falseThis is a very interesting question from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms IThis question was posed to me during an online interview.

Answer»

The correct choice is (B) false

Explanation: Array ROTATION and array REVERSAL are different operations and thus they GIVE different outputs when applied to the same array.

12.

How many swaps are required for reversing an array having n elements where n is an even number?(a) (n-1) / 2(b) n/2(c) (n/2) – 1(d) (n+1)/2Question is from Arrays Types in chapter Arrays Types of Data Structures & Algorithms II had been asked this question in unit test.

Answer» CORRECT CHOICE is (b) n/2

To EXPLAIN: The number of swaps required for an odd element and an even element array is different because in an odd element array the position of the middle element does not NEED to be CHANGED. So number of swaps required will be n/2.
13.

How many swaps are required for reversing an array having n elements where n is an odd number?(a) (n-1) / 2(b) n/2(c) (n/2) – 1(d) (n+1)/2My question is from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms IThe question was asked in an interview.

Answer»

The correct choice is (a) (n-1) / 2

The BEST I can explain: The number of swaps REQUIRED for an odd element and an even element ARRAY is different because in an odd element array the position of the middle element does not need to be changed. So the number of swaps will be (n-1) / 2.

14.

What will be the resulting array after reversing arr[]={3,5,4,2}?(a) 2,3,5,4(b) 4,2,3,5(c) 5,4,2,3(d) 2,4,5,3Question is from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms IThis question was posed to me in my homework.

Answer»

The correct answer is (d) 2,4,5,3

Easy explanation - The resulting ARRAY UPON REVERSING after reversal is ARR[]={2,4,5,3}. We can implement an algorithm for this PURPOSE in various possible ways.

15.

Reversal algorithm and juggling algorithm for array rotation have the same time complexity.(a) True(b) FalseI would like to ask this question from Arrays Types in section Arrays Types of Data Structures & Algorithms IThis question was posed to me in semester exam.

Answer»

The correct choice is (a) True

The best explanation: Time complexity of JUGGLING algorithm is O(n) which LIKE that of reversal algorithm. They ALSO have the same SPACE complexity.

16.

What is the time complexity of the juggling algorithm to rotate an array?(a) O(1)(b) O(n)(c) O(d)(d) O(n*d)My query is from Arrays Types in portion Arrays Types of Data Structures & Algorithms II have been asked this question in an international level competition.

Answer»

The CORRECT answer is (b) O(n)

Easy explanation - TIME complexity of JUGGLING ALGORITHM is O(n). Its auxiliary space complexity is O(1).

17.

Which of the following algorithm to rotate an array has the maximum time complexity?(a) rotate elements one by one(b) juggling algorithm(c) reversal algorithm(d) using a temporary arrayI would like to ask this question from Arrays Types in section Arrays Types of Data Structures & Algorithms IThis question was posed to me in examination.

Answer»

Right ANSWER is (a) rotate elements one by one

To explain: The MAXIMUM time complexity is REQUIRED by the algorithm that rotates elements one by one. It REQUIRES O(n*d) time.

18.

Predefined function rotate() in C++ is available under which header file?(a) math(b) stdio(c) stdlib(d) algorithmMy question is from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms II had been asked this question in semester exam.

Answer»

The CORRECT ANSWER is (d) algorithm

Easy explanation - The predefined function for rotating an array is rotate() in C++ which comes under the LIBRARY called algorithm. It requires 3 ARGUMENTS the first being the pointer to the starting index of the array and the last being the pointer to the last index of the array. The MIDDLE argument is the pointer to the element that becomes the first element in the rotated array.

19.

How many arguments are required by the predefined function rotate() in C++?(a) 1(b) 2(c) 3(d) 4The query is from Arrays Types topic in division Arrays Types of Data Structures & Algorithms IThe question was asked in class test.

Answer»

The correct OPTION is (c) 3

To explain: The predefined function for ROTATING an array is rotate() in C++ which comes under the LIBRARY called an algorithm. It requires 3 ARGUMENTS.

20.

Which of the following is the predefined function for array reversal in C++?(a) rotate()(b) arr_rotate()(c) array_rotate()(d) rot()My question comes from Arrays Types in section Arrays Types of Data Structures & Algorithms II got this question by my school teacher while I was bunking the class.

Answer»

Right option is (a) ROTATE()

To EXPLAIN: The predefined function for rotating an array is rotate() in C++. It is defined under the LIBRARY ALGORITHM and requires 3 arguments.

21.

What will be the auxiliary space complexity of the code to rotate an array by using the reversal algorithm (d = number of rotations)?(a) O(1)(b) O(n)(c) O(d)(d) O(n*d)The query is from Arrays Types in chapter Arrays Types of Data Structures & Algorithms II got this question by my college director while I was bunking the class.

Answer» RIGHT answer is (a) O(1)

Explanation: The reversal ALGORITHM for rotating an array does not require any AUXILIARY space. So the auxiliary space COMPLEXITY will be O(1).
22.

To rotate an array by using the algorithm of rotating its elements one by one is an in place algorithm.(a) true(b) falseThis question is from Arrays Types topic in section Arrays Types of Data Structures & Algorithms II got this question in a job interview.

Answer»

The CORRECT answer is (a) true

The best I can explain: The auxiliary space requirement of the mentioned algorithm is O(1). So it QUALIFIES to be an in PLACE algorithm.

23.

What will be the resulting array after rotating arr[]={1, 2, 3, 4, 5} by 2?(a) 2, 1, 3, 4, 5(b) 3, 4, 5, 1, 2(c) 4, 5, 1, 2, 3(d) 1, 2, 3, 5, 4I need to ask this question from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms IThe question was posed to me in a national level competition.

Answer»

Correct OPTION is (b) 3, 4, 5, 1, 2

To explain: When the given ARRAY is ROTATED by 2 then the resulting array will be

Rotation 1: {2,3,4,5,1}

Rotation 2: {3,4,5,1,2}.

THUS, the final array is {3,4,5,1,2}.

24.

What is the space complexity of the code that uses merge sort for determining the number of inversions in an array?(a) O(n)(b) O(log n)(c) O(1)(d) O(n log n)My query is from Arrays Types in portion Arrays Types of Data Structures & Algorithms II have been asked this question in an international level competition.

Answer»

Right ANSWER is (a) O(n)

Best EXPLANATION: The SPACE complexity required by the code will be O(n). It is the same as the space complexity of the code of standard MERGE sort.

25.

The time complexity of the code that determines the number of inversions in an array using self balancing BST is lesser than that of the code that uses loops for the same purpose.(a) true(b) falseMy enquiry is from Arrays Types in division Arrays Types of Data Structures & Algorithms IThis question was posed to me during an online interview.

Answer»

Right choice is (a) true

The EXPLANATION is: The TIME complexity of the CODE that determines the number of inversions in an array using self balancing BST is O(n log n) which is lesser than the time complexity taken by the code that USES loops.

26.

What is the time complexity of the code that uses self balancing BST for determining the number of inversions in an array?(a) O(n^2)(b) O(n)(c) O(log n)(d) O(n log n)I'd like to ask this question from Arrays Types topic in division Arrays Types of Data Structures & Algorithms IThis question was addressed to me in examination.

Answer»

Right answer is (d) O(n log n)

Easiest EXPLANATION - When a self BALANCING BST LIKE an AVL tree is USED to calculate the number of inversions in an array then the time complexity is O(n log n) as AVL insert takes O(log n) time.

27.

What is the time complexity of the code that uses merge sort for determining the number of inversions in an array?(a) O(n^2)(b) O(n)(c) O(log n)(d) O(n log n)My doubt stems from Arrays Types topic in division Arrays Types of Data Structures & Algorithms IThe question was posed to me in an online interview.

Answer»

Right ANSWER is (d) O(n log n)

Explanation: The CODE of MERGE sort is slightly modified in order to calculate the number of inversions in an array. So the TIME complexity of merge sort remains unaffected and hence the time complexity is O(n log n).

28.

The time complexity of the code that determines the number of inversions in an array using merge sort is lesser than that of the code that uses loops for the same purpose.(a) true(b) falseI want to ask this question from Arrays Types topic in section Arrays Types of Data Structures & Algorithms II had been asked this question in homework.

Answer»

The CORRECT choice is (a) true

The best explanation: The time complexity of the CODE that determines the number of inversions in an array using merge SORT is O(n LOG n) which is LESSER than the time complexity taken by the code that uses loops.

29.

What is the condition for two elements arr[i] and arr[j] to form an inversion?(a) arr[i] arr[j] and i < jThe question is from Arrays Types topic in section Arrays Types of Data Structures & Algorithms IThe question was asked in an international level competition.

Answer»

Correct choice is (d) arr[i] > arr[J] and i < j

The explanation is: For two elements to form an inversion the necessary condition is arr[i] > arr[j] and i < j. The NUMBER of inversions in an ARRAY indicate how CLOSE or far the array is from being completely sorted.

30.

How many inversions does a sorted array have?(a) 0(b) 1(c) 2(d) cannot be determinedI need to ask this question from Arrays Types in chapter Arrays Types of Data Structures & Algorithms IThis question was posed to me in an interview for job.

Answer»

The correct option is (a) 0

For EXPLANATION: When an ARRAY is sorted then there cannot be any inversion in the array. As the NECESSARY condition for an inversion is arr[i]>arr[j] and i

31.

What does the number of inversions in an array indicate?(a) mean value of the elements of array(b) measure of how close or far the array is from being sorted(c) the distribution of values in the array(d) median value of the elements of arrayThe origin of the question is Arrays Types in chapter Arrays Types of Data Structures & Algorithms IThis question was posed to me in semester exam.

Answer»

Correct choice is (b) measure of how CLOSE or far the array is from being SORTED

For EXPLANATION: The number of inversions in an array INDICATES how close or far the array is from being completely sorted. The array is sorted if the number of inversions are 0.

32.

In what way the Symmetry Sparse Matrix can be stored efficiently?(a) Heap(b) Binary tree(c) Hash table(d) Adjacency ListThe above asked question is from Arrays Types topic in chapter Arrays Types of Data Structures & Algorithms IThe question was posed to me in an interview for job.

Answer» RIGHT OPTION is (b) BINARY tree

Best explanation: SINCE SYMMETRY Sparse Matrix arises as the adjacency matrix of the undirected graph. Hence it can be stored efficiently as an adjacency list.
33.

Which one of the following is a Special Sparse Matrix?(a) Band Matrix(b) Skew Matrix(c) Null matrix(d) Unit matrixThe doubt is from Arrays Types in section Arrays Types of Data Structures & Algorithms IThis question was addressed to me in quiz.

Answer» CORRECT choice is (a) Band Matrix

For explanation: A band matrix is a sparse matrix whose NON zero ELEMENTS are bounded to a diagonal band, comprising the main diagonal and zero or more diagonals on EITHER side.
34.

Is Sparse Matrix also known as Dense Matrix?(a) True(b) FalseI'm obligated to ask this question of Arrays Types in portion Arrays Types of Data Structures & Algorithms II got this question in unit test.

Answer»

The correct CHOICE is (b) False

Easiest explanation - Sparse Matrix is a matrix with most of the ELEMENTS as ZERO elements while DENSE Matrix is a matrix with most of the elements as Non-Zero element.

35.

Which of the following is not the method to represent Sparse Matrix?(a) Dictionary of Keys(b) Linked List(c) Array(d) HeapI want to ask this question from Arrays Types topic in division Arrays Types of Data Structures & Algorithms II have been asked this question in a job interview.

Answer»

The correct choice is (d) Heap

Easy explanation - Heap is not used to represent SPARSE Matrix while in Dictionary, rows and column numbers are used as Keys and values as Matrix entries, Linked List is used with each node of Four fields (Row, Column, Value, NEXT Node) (2D array is used to represent the Sparse Matrix with THREE fields (Row, Column, Value).

36.

The matrix contains m rows and n columns. The matrix is called Sparse Matrix if ________(a) Total number of Zero elements > (m*n)/2(b) Total number of Zero elements = m + n(c) Total number of Zero elements = m/n(d) Total number of Zero elements = m-nI'm obligated to ask this question of Arrays Types topic in chapter Arrays Types of Data Structures & Algorithms II have been asked this question in an online interview.

Answer»

Correct answer is (a) Total NUMBER of Zero elements > (m*N)/2

For explanation: For MATRIX to be SPARSE Matrix, it should contain Zero elements more than the non-zero elements. Total elements of the given matrix is m*n. So if Total number of Zero elements > (m*n)/2, then the matrix is called Sparse Matrix.

37.

Is O(n) the Worst case Time Complexity for addition of two Sparse Matrix?(a) True(b) FalseMy enquiry is from Arrays Types in division Arrays Types of Data Structures & Algorithms II got this question in homework.

Answer»

The correct choice is (a) True

To EXPLAIN: In ADDITION, the matrix is traversed linearly, hence it has the time COMPLEXITY of O(n) where n is the NUMBER of non-zero elements in the largest matrix amongst two.

38.

Who coined the term Sparse Matrix?(a) Harry Markowitz(b) James Sylvester(c) Chris Messina(d) Arthur CayleyMy question is from Arrays Types in section Arrays Types of Data Structures & Algorithms II had been asked this question in a national level competition.

Answer»

Correct answer is (a) HARRY Markowitz

Best EXPLANATION: Harry Markowitz coined the term SPARSE Matrix. James Sylvester coined the term Matrix. Chris Messina coined the term Hashtag and Arthur CAYLEY DEVELOPED the algebraic aspects of a matrix.

39.

What is the relation between Sparsity and Density of a matrix?(a) Sparsity = 1 – Density(b) Sparsity = 1 + Density(c) Sparsity = Density*Total number of elements(d) Sparsity = Density/Total number of elementsThe query is from Arrays Types topic in division Arrays Types of Data Structures & Algorithms IThis question was posed to me in an international level competition.

Answer»

Correct choice is (a) Sparsity = 1 – DENSITY

The best explanation: Sparsity of a matrix is EQUAL to 1 minus Density of the matrix. The Sparsity of matrix is defined as the TOTAL NUMBER of Zero VALUED elements divided total number of elements.

40.

Which matrix has most of the elements (not all) as Zero?(a) Identity Matrix(b) Unit Matrix(c) Sparse Matrix(d) Zero MatrixThis key question is from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms II got this question in unit test.

Answer»

Right choice is (c) SPARSE Matrix

To EXPLAIN: Sparse Matrix is a matrix in which most of the elements are ZERO. Identity Matrix is a matrix in which all principle DIAGONAL elements are 1 and REST of the elements are Zero. Unit Matrix is also called Identity Matrix. Zero Matrix is a matrix in which all the elements are Zero.

41.

Matrix A when multiplied with Matrix C gives the Identity matrix I, what is C?(a) Identity matrix(b) Inverse of A(c) Square of A(d) Transpose of AThe origin of the question is Matrix in section Arrays Types of Data Structures & Algorithms IThe question was posed to me by my school principal while I was bunking the class.

Answer»

Right option is (b) INVERSE of A

Explanation: Any square matrix when MULTIPLIED with its inverse GIVES the identity matrix. Note that non square matrices are not INVERTIBLE.

42.

Which of the following is an advantage of matrices?(a) Internal complexity(b) Searching through a matrix is complex(c) Not space efficient(d) Graph PlottingAsked question is from Matrix topic in section Arrays Types of Data Structures & Algorithms IThis question was addressed to me in final exam.

Answer»

Right option is (d) Graph Plotting

To explain: Adjacency and Incidence MATRICES are used to STORE VERTICES and EDGES of a graph. It is an advantage to plot graphs easily using matrices. But Time complexity of a matrix is O(n^2) and sometimes the internal organization BECOMES tedious. They are all disadvantages of matrices.

43.

Which of the following don’t use matrices?(a) In solving linear equations(b) Image processing(c) Graph theory(d) Sorting numbersThe origin of the question is Matrix in division Arrays Types of Data Structures & Algorithms II got this question in exam.

Answer»

The correct ANSWER is (d) Sorting numbers

Best explanation: Numbers uses ARRAYS(1-D) for sorting not matrices(2-D arrays). Solving linear equations is a separate field in Mathematics involving matrices, IMAGE processing stores the PIXELS in the form of matrices, and the graphs are represented with the help of matrices to indicate the nodes and EDGES.

44.

Suffix array can be created in O(nlogn) time.(a) True(b) FalseThe origin of the question is Arrays Types in section Arrays Types of Data Structures & Algorithms II had been asked this question in class test.

Answer» RIGHT answer is (a) True

Easiest EXPLANATION - Suffix ARRAY can be constructed in O(n^2logn) time USING sorting algorithms but it is possible to BUILD the suffix array in O(nlogn) time using prefix doubling.
45.

What is the time required to locate the occurrences of a pattern P of length m in a string of length n using suffix array?(a) O(nm)(b) O(n^2)(c) O(mnlogn)(d) O(mlogn)My question comes from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms IThe question was posed to me in an interview for internship.

Answer»

Right option is (d) O(mlogn)

EXPLANATION: Suffix arrays are used to FIND the occurrences of a pattern in a STRING. Pattern of length m will require m characters to compare, so USING suffix array we can find occurrences of a pattern in the string of length n in O(mlogn) time.

46.

LCP array and ______ is used to construct suffix tree.(a) Hash tree(b) Hash trie(c) Suffix array(d) Balanced treeQuestion is from Arrays Types in section Arrays Types of Data Structures & Algorithms II have been asked this question during a job interview.

Answer»

Correct option is (c) SUFFIX ARRAY

Explanation: Suffix tree can be CREATED using an LCP array and a suffix array. If we are GIVEN a string of length (n + 1) and its suffix array and LCP array, we can construct the suffix tree in linear time i.e in O(n) time.

47.

What will be the suffix array of the string “engineering”?(a) 2 3 8 4 9 1 7 5 0 6 10(b) 5 0 6 1 4 9 1 7 0 2 3 8(c) 5 0 6 10 2 4 9 1 7 3 8(d) 5 0 6 10 2 3 8 4 9 1 7This interesting question is from Arrays Types topic in chapter Arrays Types of Data Structures & Algorithms IThis question was posed to me during an internship interview.

Answer»

The correct CHOICE is (d) 5 0 6 10 2 3 8 4 9 1 7

To EXPLAIN: Correct choice is : 5 0 6 10 2 3 8 4 9 1 7.

Because the suffix array formed will be: 5 eering 0 engineering 6 ering 10 G 2 gineering 3 ineering 8 ing 4 neering 9 ng 1 ngineering 7 ring.

48.

If comparison based sorting algorithm is used construct the suffix array, then what will be time required to construct the suffix array?(a) O(nlogn)(b) O(n^2)(c) O(n^2logn)(d) O(n^2) + O(logn)The doubt is from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms II have been asked this question during an internship interview.

Answer»

Correct choice is (c) O(n^2logn)

Easy explanation - On average COMPARISON BASED sorting algorithms require O(NLOGN) comparisons. But comparing a suffix TAKES O(n). So, overall TIME to construct the suffix array will be O(nlogn) * O(n) = O(n^2logn).

49.

Suffix array is space efficient and faster than the suffix tree.(a) True(b) FasleMy query is from Arrays Types topic in division Arrays Types of Data Structures & Algorithms II got this question by my college professor while I was bunking the class.

Answer»

Right CHOICE is (b) Fasle

Explanation: Suffix ARRAYS are more space efficient than the suffix trees as they just store the original STRING and an array of INTEGER. But working with suffix tree is FASTER than that of the suffix array.

50.

Suffix array can be created by performing __________ traversal of a suffix tree.(a) breadth-first(b) level order(c) depth-first(d) either breadth-first or level orderI want to ask this question from Arrays Types topic in section Arrays Types of Data Structures & Algorithms IThis question was addressed to me in exam.

Answer»

Right answer is (c) depth-first

Best explanation: A suffix tree is a trie, which CONTAINS all the suffixes of the GIVEN STRING as their keys and POSITIONS in the string as their values. So, we can construct a suffix array by performing the depth-first traversal of a suffix tree.