Thread: What's a permuted index?

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    110

    What's a permuted index?

    So in my book, its giving me this problem..but I have no idea what its asking me to do. I cant figure out what a permuted index is doing.

    Code:
    5-1. Design and implement a program to produce a permuted index. A permuted index is one in which each phrase is indexed by every word in the phrase. So, 
    given the following input,
    The quick brown fox
    jumped over the fence
    
    the output would be
    
        The quick     brown fox
    jumped over the     fence
     The quick brown     fox
                        jumped over the fence
            jumped       over the fence
               The        quick brown fox
      jumped over         the fence
                      The quick brown fox
    I copied this to the best of my ability. I tried to google it but I could not find any sites that thoroughly explained it. Might be one or two spaces off, but any help would be appreciated =D

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    So it's an index (as in the thing at the back of a book), it looks like, but every word in the phrase is used as a search term. So the first phrase is indexed under "brown", "fox", "quick", and "The" and the second by "fence", "jumped", "over", and "the".

    I'm not sure what you're getting at in terms of the output.

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    110
    Hm...I sadly still don't get it...That output was what was given me in the book. I simply tried to duplicate it. I am however off by a few spaces I bet.

  4. #4
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Given any prefix of the line, you need an index entry to get the rest of the line.

    Sentence
    A1 A2 A3 A4 A5

    Index
    : A1 A2 A3 A4 A5
    A1 : A2 A3 A4 A5
    A1 A2 : A3 A4 A5
    A1 A2 A3 : A4 A5
    A1 A2 A3 A4 : A5


    Your example looks funny because the entries are not in order, but they're all there. I'm not sure how they'd want you to distinguish between the beginning of different phrases though.

  5. #5
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    That's from Accelerated C++ It's exactly like that if I remember, I never really figured it out, just close then I just moved on since it was so frusterating, my brain startet sweating xP
    Currently research OpenGL

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Permuted Index Help
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 03-27-2009, 11:03 PM
  2. 20q game problems
    By Nexus-ZERO in forum C Programming
    Replies: 24
    Last Post: 12-17-2008, 05:48 PM
  3. Function to check memory left from malloc and free?
    By Lechx in forum C Programming
    Replies: 4
    Last Post: 04-24-2006, 05:45 AM
  4. file index update error
    By daluu in forum C Programming
    Replies: 1
    Last Post: 04-28-2003, 02:47 AM
  5. What is a permuted index?
    By Clyde in forum C++ Programming
    Replies: 2
    Last Post: 04-12-2002, 11:52 AM