Tag Archives: python
Heap sort in Python.
Here is an example of heapsort in Python. This sorting method happens to be my favorite of the bunch – I like to think that this is the most elegant sorting method, but I’m sure you could argue against me. Edit: I renamed percolateDown to percolateUp because I realized its really more of a “move [...]
Generators in Python.
The following examples are using Python 2.x but now after seeing Python 3.x released I’m interested in generators larger role in Python. Generators remind me of accumulators: generators accumulate a comprehensive result that you can add to with calls to yield. Take the following as an example. def cubes(c): for i in range(c): yield i [...]
Hadoop example for Exim logs with Python.