Question
What is the time complexity of the KMP algorithm for
searching a pattern of length 'M' in a text of length 'N'?Solution
The KMP algorithm has a time complexity of O(M) for preprocessing the pattern (building the LPS array) and O(N) for searching the text. Therefore, the total time complexity is O(N + M), which is significantly better than the Naive algorithm's worst-case O(MN).
The boolean function f(x, y) = x OR (NOT(y)) is equivalent to which of the following boolean expressions?
Which tree structure is commonly used in file systems to organize and manage disk blocks efficiently?
Which component in the CPU is responsible for fetching instructions from memory and incrementing the program counter?
Which device operates at physical layer
Which layer of the OSI model interacts directly with the user or application software?
Which command is used to change the permissions of a file in a Unix/Linux system?
‘\a’ is used for what in C++
The SI unit for measuring electric resistance is:
What is the most common material used for making transistors?
Which of the following power plants relies on the fission of uranium atoms to generate heat?