Sometimes bit operations can be done much, much more efficiently than higher level solutions. Take this problem that I can't remember the source of
Someone wrote:You are given a stream of N unsorted integers 0 to N-2 inclusive that you do not have random access to or the ability to modify in-place. One of the numbers appears 2 times, and the rest a single time. Your goal is to find the duplicate number. There is a O(n) time and O(1) space solution to this problem.
There is a bit operation that accomplishes this with an efficiency unparalleled by any complex data structure. Such solutions rarely come up, but are AWESOME when they do; the solution to this is extremely simple and short as well. Bit operations are just another tool in a programmer's tool box for solving problems.
Due to the reasons discussed here
we will be moving to python-forum.io
on October 1, 2016.
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.