Programmingpraxis - programmingpraxis.com - Programming Praxis
General Information:
Latest News:
Two Sieving Problems 27 Aug 2013 | 02:00 pm
We have today two exercises devoted to enumerating prime numbers: 1) How many prime numbers are there between 1050 and 1050 + 106? 2) How many prime numbers between 1,000,000 and 2,000,000 are congr...
Three Interview Questions 23 Aug 2013 | 02:00 pm
We have three simple interview questions today: 1) Verify that a binary tree is a binary search tree. In a binary search tree, all nodes to the left of the current node have values less than the valu...
More Bit Hacks 20 Aug 2013 | 02:00 pm
We studied three bit hacks in a previous exercise. In today’s exercise we look at three more: 1) Compute the minimum (or maximum) of two integers without branching. 2) Determine if an integer is a p...
Monkey Grid Puzzle 16 Aug 2013 | 02:00 pm
I’m not sure of the original source of this fun little puzzle: There is a monkey which can walk around on a planar grid. The monkey can move one space at a time left, right, up or down. That is, from...
Unix Paths 13 Aug 2013 | 02:00 pm
[ Today’s exercise was written by guest author Robert Fisher. Having worked on shrinkwrapped consumer software, e-commerce web apps, embedded systems, and insurance OLTP systems, Robert currently writ...
Bit Hacks 9 Aug 2013 | 02:00 pm
A time-honored tradition among programmers is to hack a program to reduce the number of operations it takes, and a major component of that effort goes in to bit hacks, which we can define as dealing w...
Sophie Germain Primes 6 Aug 2013 | 02:00 pm
A prime number p is a Sophie Germain prime if 2p+1 is also prime. The list of Sophie Germain primes begins 2, 3, 5, 11, 23, 29, 41, 53, 83, 89, 113, 131, (A005384); it is not known if the list is infi...
Ordered Hash Tables 2 Aug 2013 | 02:00 pm
In a normal hash table, a key is hashed then linear search is performed in the bucket where the key will be found if it exists in the hash table. A successful search terminates as soon as the key is f...
Who Buys The Croissants? 30 Jul 2013 | 02:00 pm
There was a big buzz on Stack Overflow recently when a question about buying croissants was asked: At my office someone buys croissants for everybody every Friday. Sometimes we have problems arrangin...
Find X[i] = i In An Array 26 Jul 2013 | 02:00 pm
We have today another of our unlimited supply of interview questions: this one supposedly comes from Amazon: Given an array X[0..n-1] of integers sorted into ascending order with no duplicates, find ...