Recall & Review
beginner Click to reveal answer
What is the Longest Common Prefix (LCP) in a list of strings?
The Longest Common Prefix is the longest starting substring that is common to all strings in the list.
intermediate Click to reveal answer
How does the horizontal scanning method find the Longest Common Prefix?
It starts with the first string as the prefix and compares it with each string, shortening the prefix until it matches all strings.
intermediate Click to reveal answer
What is the time complexity of the vertical scanning approach for Longest Common Prefix?
The time complexity is O(S), where S is the sum of all characters in all strings because it checks characters column by column.
beginner Click to reveal answer
In Go, which data type is best suited to store the Longest Common Prefix result?
A string type is best suited to store the Longest Common Prefix because it represents text data.
advanced Click to reveal answer
Why might the divide and conquer method be efficient for Longest Common Prefix?
It splits the list into halves, finds LCP for each half, then merges results, reducing comparisons and improving efficiency.
What does the Longest Common Prefix represent in a list of strings?
✗ Incorrect
The Longest Common Prefix is the longest starting substring common to all strings.
Which approach compares characters column by column to find the LCP?
✗ Incorrect
Vertical scanning checks each character position across all strings before moving to the next.
If the first string is empty, what is the Longest Common Prefix?
✗ Incorrect
If the first string is empty, the LCP must be empty because no prefix can be longer.
What is the best data type to store the LCP in Go?
✗ Incorrect
The LCP is text, so string is the appropriate data type.
Which method splits the list into halves to find the LCP?
✗ Incorrect
Divide and conquer splits the list and merges results to find the LCP efficiently.
Explain how the horizontal scanning method finds the Longest Common Prefix in a list of strings.
Think about comparing prefixes one by one from left to right.
You got /4 concepts.
Describe the advantages of using divide and conquer for finding the Longest Common Prefix.
Consider how breaking the problem into smaller parts helps.
You got /5 concepts.
