51. What is the worst case time complexity of inserting an element into the sorted array?
Answer:
Explanation:In the worst case, an element must added to the front of the array, which means that rest of the elements have to be shifted, hence the worst case time complexity becomes O(n).
Workspace
Nagarro
52. 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
Answer:
Explanation:Advantages of the suffix array over suffix tree are : (i) Lesser space requirement (ii) Improved cache locality and (iii) Simple algorithms to construct suffix arrays in linear time.
Workspace
Nagarro
53. What is the time complexity of the code that uses merge sort for determining the number of inversions in an array?
Answer:
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).
Workspace
Nagarro
54. The complexity of searching an element from a set of n elements using Binary search algorithm is
Answer: O(log n)
Explanation:Here is no explanation for this answer
Workspace
Nagarro
55. Which algorithm is having highest space complexity?
Answer: Merge Sort
Explanation:Here is no explanation for this answer
Workspace
Nagarro
56. The complexity of linear search algorithm is
Answer: O(n)
Explanation:Here is no explanation for this answer
Workspace
Nagarro
57. What is the time complexity to insert an element into the direct address table?
Answer:
Explanation:As every key has a unique array position, it takes constant time to insert an element.
Workspace
Nagarro
58. What is the time complexity to delete an element from the direct address table?
Answer:
Explanation:As every key has a unique array position, it takes constant time to delete an element, although the deleted position must be specified by nil.
Workspace
Nagarro
59. What is the time complexity of insert function in a hash table using a doubly linked list?
Answer:
Explanation:Time complexity of insert function in a hash table is O(1). Condition is that the number of collisions should be low.
Workspace
Nagarro
60. #include
main()
{
if( printf("")) // prints content of printf statement and
//takes length of the string for if case //execution in this case its 1, So true
printf("Prep");
else
{
}
}
Answer:
Explanation:Here is no explanation for this answer
Workspace
Wipro NLTH Nagarro