title: Is it possible to make a minimal perfect hash function in this situation?
body: <p>I want to create a Hash Map (or another structure, if you have any suggestions) to store key value pairs. The keys will all be inserted at once at the same time as the map is created, but I don't know what the keys will be (arbitrary length strings) until runtime, when I need to create the map. </p>
  
  <p>I am parsing a query string like this <code>"x=100&amp;name=bob&amp;color=red&amp;y=150"</code> (but the string can have an unlimited number of variables and the variables can have any length name).</p>
  
  <p>I want to parse it once and create a Hash Map, preferably minimal and with a perfect hash function to satisfy linear storage requirements. Once the map is created the values won't be modified or deleted, no more key value pairs will be added to the map either, so the entire map is effectively a constant. I'm assuming that a variable doesn't occur twice in the string (IE. <code>"x=1&amp;x=2"</code> is not valid).</p>
  
  <p>I am coding in <code>C</code>, and currently have a function that I can use like <code>get("x")</code> which will return the string <code>"100"</code>, but it parses the query string each time which takes <code>O(n)</code> time. I'd like to parse it once when it is first loaded since it is a very large query string and every value will be read several times. Even though I'm using <code>C</code>, I don't need code in <code>C</code> as an answer. Pseudocode, or any suggestions at all would be awesome! </p>