Microsoft Interview Question
Software Engineer / DevelopersOk, so this is a grammar, so here are the first two steps:
Encode[product]
-> Hash["product"] Encode[sku] Encode[size] Encode[type] END Encode[itinerary] END
-> Hash["product"] Hash["sku"] 9820Y Hash["size"] small Hash["type"] tshirt END Hash["itinerary"] END Encode[sold] Encode[onhold] Encode[returned] END END
-> Hash["product"] Hash["sku"] 9820Y Hash["size"] small Hash["type"] tshirt END Hash["itinerary"] END Hash["sold"] END 283 END Hash["onhold"] END 232 END Hash["returned"] END 23 END END END
I think that's right... all the ENDs would be changed to 01 and the hashed values would be looked up in a dictionary.
Just apply Huffman's compression algorithm by sorting all the words by their length descending. now the longest words get a value of 0, then next one get 1 and so on..
once you form this, just use the same procedure listed in Corman to form a tree to compress the algorithm.
What the .... ?
- dontUnderstandQuestion June 26, 2005