A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
// Assuming you, for example, are going through dates and for each date you collect ids and for each id the number of times | |
// the object identified by that id (e.g an ad banner, a product, anything) was clicked, or anything like that. | |
// | |
// That is, assuming that you are going to have to update the value of an object 1+ times, as opposed to just once (you can use other | |
// more efficient algorithms to deal with that -- e.g maintain a top-K list as you go, etc), how do you then sort the final list that holds | |
// (id, value) - that is, for each distinct id, the sum of times it was clicked (or anything)? | |
// | |
// Sorting a list that is comprised of 1million distinct IDs is just really slow. | |
// This is one way to do it, which is particularly efficient if the distribution of values is large. | |
// |