Haskell Quiz/Index and Query

From HaskellWiki
< Haskell Quiz
Revision as of 21:48, 18 December 2006 by JohannesAhlmann (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Ruby Quiz #54:

An indexing scheme where you number all encountered words ascendingly and represent the content of a file as bit-array with the bit at position 2^i representing the i'th word.

So if you have for example:

Doc1=The quick brown fox
Doc2=Jumped over the brown dog
Doc3=Cut him to the quick

This would yield:

Doc1=00000001111
Doc2=00001110101
Doc3=11110000011

You can very quickly return the Docs that contain 'the' [ Doc1,Doc2,Doc3 ], or 'brown' [ Doc1,Doc2 ] etc.

The Problem

Solutions