title: Generate all unique substrings for given string
body: <p>Given a string <code>s</code>, what is the fastest method to generate a set of all its unique substrings?</p>
  
  <p>Example: for <code>str = "aba"</code> we would get <code>substrs={"a", "b", "ab", "ba", "aba"}</code>.</p>
  
  <p>The naive algorithm would be to traverse the entire string generating substrings in length <code>1..n</code> in each iteration, yielding an <code>O(n^2)</code> upper bound.</p>
  
  <p>Is a better bound possible?</p>
  
  <p><em>(this is technically homework, so pointers-only are welcome as well)</em></p>