-
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
Tag Archives: challenge
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
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
Solution for the Random Selection Challenge
A few days ago, I wrote up two small Python Challenges. Several people have presented solutions for the first challenge, and I also posted my solution in the comments there. However, the second challenge remained unsolved, and I will present … Continue reading
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
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
A classic programming challenge, in Python
It has become a tradition for computer scientists to create various self referential ‘strange loops’. Traditions such as writing a compiler in the language it compiles are actually quite useful – and also very interesting. This tradition also branched to … Continue reading
Posted in Challenges, computer science, Programming Philosophy, Python
Tagged challenge, Python, Quine
6 Comments
Small Python Challenge No. 1
I bet I already wrote that sometime earlier, but I found myself today writing the following function: def blocks(seq, block_len): “”"blocks(range(5),2) -> [[0, 1], [2, 3], [4]]”"” seq_len = len(seq) if seq_len%block_len == 0: num_blocks = seq_len/block_len else: num_blocks = … Continue reading