Popular recipes tagged "compact"http://code.activestate.com/recipes/tags/compact/popular/2013-01-17T09:28:24-08:00ActiveState Code RecipesProof-of-concept for a more space-efficient, faster-looping dictionary (Python) 2013-01-17T09:28:24-08:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/578375-proof-of-concept-for-a-more-space-efficient-faster/ <p style="color: grey"> Python recipe 578375 by <a href="/recipes/users/178123/">Raymond Hettinger</a> (<a href="/recipes/tags/compact/">compact</a>, <a href="/recipes/tags/dictionary/">dictionary</a>). Revision 20. </p> <p>Save space and improve iteration speed by moving the hash/key/value entries to a densely packed array keeping only a sparse array of indices. This eliminates wasted space without requiring any algorithmic changes.</p> Representing a set in a compact way (Python) 2011-04-24T10:55:45-07:00jimmy2timeshttp://code.activestate.com/recipes/users/4177690/http://code.activestate.com/recipes/577660-representing-a-set-in-a-compact-way/ <p style="color: grey"> Python recipe 577660 by <a href="/recipes/users/4177690/">jimmy2times</a> (<a href="/recipes/tags/compact/">compact</a>, <a href="/recipes/tags/compressed/">compressed</a>, <a href="/recipes/tags/data/">data</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/set/">set</a>, <a href="/recipes/tags/structure/">structure</a>). Revision 5. </p> <p>Implements a data structure for sets of natural numbers, represented by a single integer. The interface is similar to the built-in structure 'set'.</p>