Top "Programming-pearls" questions

Programming pearls are unique problems or solutions that might puzzle a programmer, they have grown from real problems that have irritated real programmers, just as natural pearls grow from grains of sand that irritate oysters.

Fastest algorithm for circle shift N sized array for M position

What is the fastest algorithm for circle shifting array for M positions? For example, [3 4 5 2 3 1 4] shift M = 2 positions should be [1 4 3 4 5 2 3]. Thanks …

algorithm arrays math puzzle programming-pearls
Why is modulus operator slow?

Paraphrasing from in "Programming Pearls" book (about c language on older machines, since book is from the late 90's): Integer …

modulo integer-division cpu-speed programming-pearls
How to find the subarray that has sum closest to zero or a certain value t in O(nlogn)

Actually it is the problem #10 of chapter 8 of Programming Pearls 2nd edition. It asked two questions: given an array A[] …

algorithm programming-pearls