Programming Question

Question: Given a search string of three words, find the smallest snippet of the document that contains all three of the search words—i.e., the snippet with smallest number of words in it. You are given the index positions where these words in occur search strings such as word1:(1, 4, 5), word2: (4, 9, 10), and word3: (5, 6, 15). Each of the lists are in sorted order, as above.

From: Algorithm Design Manual [Skiena]

Subject: Sorting and Searching

Load Another Question


Select a Subject