hw5

From: Michelangelo Grigni (mic@mathcs.emory.edu)
Date: Sat Apr 21 2012 - 20:01:48 EDT

  • Next message: Michelangelo Grigni: "hw5 written online"
    JH wrote:
    > I'm not really sure how to compute T[i] from L[i]. Computing F is just sorting L,
    > that part is easy, as is finding L[i]. Is there a trick to avoid identifying the wrong
    > character (the wrong 'a' or something)? Do I just search through F ...
    
    There is a trick: pretend you are sorting L to produce F, with key-indexed
    counting sort (like a single pass in book/LSD.java) which is stable.   Each
    time that you would  copy a char from L to F, like this:
        F[j] = L[i]
    you instead just save the index information in T:
        T[i] = j
    Doing it this way, you do not really need the F array at all.
    


    This archive was generated by hypermail 2.1.4 : Sat Apr 21 2012 - 20:02:18 EDT