79005 matching questions

What is the pre-processing time of Rabin and Karp Algorithm?

  • ATheta(m2)
  • BTheta(mlogn)
  • CTheta(m)
  • DBig-Oh(n)
Show answerHide answer

Correct answer C

The pre-processing time of Rabin and Karp Algorithm is Theta(m). The for loop in the pre-processing algorithm runs for m (the length of the pattern) times, hence the pre-processing time is Theta(m). This is the time complexity of the pre-processing phase of the Karp-Rabin algorithm.

Which of the following is the Best Case Time Complexity Quicksort algorithm?

  • AO(n log n²)
  • BO²(n log n)
  • CO(n log n)
  • DNone of these
Show answerHide answer

Correct answer C

Best case occurs when the pivot divides the array into two equal halves each time. This leads to a balanced recursion tree. Hence, Quick Sort runs in O(n log n) time in the best case. Key facts: Average case → O(n log n) Worst case → O(n²) Example size: n = 8 → log₂(8) = 3 levels Total comparisons ≈ n log n.

Hardware of computer includes ___?

  • APhysical part
  • BHard disk
  • CBoth
  • DNone of these
Show answerHide answer

Correct answer C

Computer hardware includes the physical parts of a computer, such as the case, central processing unit, monitor, mouse, keyboard, computer data storage, graphics card, sound card, speakers and motherboard.