Given a sequence such as S = {1,8,2,1,4,1,2,9,1,8,4}, I need to find the minimal-length subsequence that contains all element of S (no duplicates, order does n
If you need to do this quite often for the same sequence and different sets you can use inverted lists for this. You prepare the inverted lists for the sequence and then collect all the offsets. Then scan the results from the inverted lists for a sequence of m sequential numbers.
With n the length of the sequence and m the size of the query the preparation would be in O(n). The response time for the query would be in O(m^2) if I am not miscalculating the merge step.
If you need more details have a look at the paper by Clausen/Kurth from 2004 on algebraic databases ("Content-Based Information Retrieval by Group Theoretical Methods"). This sketches out a general database framework that can be adapted to your task.