-
Recent Posts
Recent Comments
Archives
- June 2011
- February 2011
- January 2011
- December 2010
- April 2010
- March 2010
- February 2010
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- February 2007
Categories
- Algorithms
- Assembly
- C
- Challenges
- Compilation
- computer science
- Cryptography
- CSS
- Databases
- decompilation
- Design
- Fractals
- Game Development
- Geometry
- gotchas
- Graphics
- Group Theory
- Humour
- Javascript
- Linux
- Math
- Miscellaneous
- Optimization
- Optimization
- Optimization
- Optimization
- Origami
- Personal
- Programming
- Programming Philosophy
- Projects
- Protocols
- Python
- rants
- Research
- Security
- Sound
- startup
- Statistics
- Teaching Programming
- Testing
- Uncategorized
- Utility Functions
- web-design
Category Archives: Challenges
Small programming challenge No. 6 – nblocks
I came up with this challenge when I had to write a function to divide a sequence to percentiles. I needed this to calculate some statistics over trips for plnnr.com. “This sounds trivial” I thought, and reached for my simple … Continue reading
Posted in Challenges, Programming, Python, Statistics
Tagged blocks, challenge, nblocks, percentile, Python
21 Comments
The mathematics behind the solution for Challenge No. 5
If you take a look at the various solutions people proposed for the last challenge of generating a specific permutation, you’ll see that they are very similar. Most of them are based on some form of div-mod usage. The reason … Continue reading
Posted in Challenges, computer science, Programming, Python
Tagged base systems, factorial, Knuth, Math, permutations
Leave a comment
Small Programming Challenge no. 5 – Generating a Permutation
I thought of this one quite a long time ago, and I believe that the idea behind it is pretty nice mathematically. I got the idea for it from Knuth’s “The Art of Computer Programming”. The challenge is simple: write … Continue reading
My solution to the counting sets challenge
A few days ago, I wrote up a challenge – to count the number of sets a given set is contained in. In the comments, I touched briefly on the original problem from which the challenge was created, and I’ll … Continue reading
Posted in Challenges, computer science, Python
Tagged challenge, Programming, Sets, Solution
5 Comments
Small Python Challenge No. 4 – Counting Sets
This is a problem that I encountered a short while ago. It seems like it could be easily solved very efficiently, but it’s not as easy as it looks. Let’s say that we are given N (finite) sets of integers … Continue reading
Some Assembly Required No. 1
I’ve been working on some of the instruction tests in vial, and I wanted to test the implementation of LOOP variants. My objective was to make sure the vial version is identical to the real CPU version (as discussed here). … Continue reading
Posted in Assembly, Challenges, Programming, Testing
Tagged Assembly, challenge, Testing, vial
2 Comments
Small Python Challenge No. 3 – Random Selection
This time I’ll give two related problems, both not too hard. Lets warm up with the first: You have a mapping between items and probabilities. You need to choose each item with its probability. For example, consider the items [‘good’, … Continue reading
Posted in Challenges, Math, Programming, Python
Tagged challenge, probability distribution, Programming, Python, random selection, Statistics
12 Comments
LRU cache solution: a case for linked lists in Python
The reason I put up the LRU cache challenge up, was that I couldn’t think of a good solution to the problem without using linked lists. This has been pointed to by Adam and Erez as well. Adam commented on … Continue reading
Top 13 challenge sites
Statusreport in his new blog Ingeration has compiled a list of top challenge sites. I must admit, I already knew some of them in the past and he also told me about some of them earlier. Still, this time around … Continue reading
Small Python Challenge No. 2 – LRU Cache
Caching is easy. Consider the cache I used to optimize the recursive spring: class _NotInDict(object): pass _NotInDict = _NotInDict() def cached(func): cache = {} def wrapper_func(*args): prev_result = cache.get(args, _NotInDict) if prev_result is _NotInDict: result = func(*args) cache[args] = result … Continue reading
Posted in Algorithms, Challenges, computer science, Programming, Python, Utility Functions
Tagged challenge, LRU-cache, Python
2 Comments