Академический Документы
Профессиональный Документы
Культура Документы
Lahore Campus
Mid Term Assessment (Spring-2020 Semester)
Department of Computer Sciences
Instructions:
Read out the Instructions carefully.
I. Attempt all questions
II. The questions include a marking scheme and this is particularly important for questions requiring
descriptive answers. The number of marks should guide the length of the answer.
III. If you cannot understand a solution for a question, or suspect that it is wrong, spend an hour or so to
attempt to fully understand it. Then, if you are still uncertain, leave it for a day or two and come back to
it with a fresh mind.
IV. Do not copy from internet or slides or book, use your own words. The plagiarism report will be generated
for each mid-term exam and if any material found copied from internet or similar to other students mid-
term then he/she will be marked as zero. Write in your own words.
V. Write every step wherever required, do not use short cuts.
OBJECTIVES:
1
Problem 1: Find the Longest Common Prefix (LCP) between given set of strings. [08 Marks]
Write an efficient algorithm by using divide and conquer technique to find the longest Common Prefix
(LCP) between given set of strings.
For Example:
Input: technique, technician, technology, technical
Output: The longest common prefix is “techn”
Calculate the runtime of algorithm and represent in theta/ Oh/ Omega notation.
***************************The End***************************
2