title: Couple of stack operations (a pop+a push) vs a Hash Table alternative
body: <p>I have a process and it's defined <code>stack</code>. Now while pushing an item on to <code>stack</code>, I need to check if a same/similar item already exists. If not - push the new item.
  This involves two stack operations </p>
  
  <ol>
  <li>pop a similar type item, compare if
  its the same as item being pushed</li>
  <li>then push the latest.</li>
  </ol>
  
  <p>My question is - is the cost incurred worth it or should I go for maintaining a hash table for my stack entries to make this decision easier.?
  Otherwise put, how costly are the stack operations..?</p>
  
  <p>One more thing on a flat memory model like LINUX, would it be absolutely wrong to increase the preallocated stack size on need basis (say by realloc) ?</p>