Tuesday, April 23, 2013

Zig-zag search

This is an interesting problem that I ran into. The problem definition goes like this.
You are given an array of integers. The array is considerably large (say 5 million elements). You are given two inputs: an index i in the array and an integer value v. Start searching the array for value v from the index i, and expand your search towards the two edges of the array. Return the index where the value v occurs closest to index i. If the value v occurs on both sides of index i at an equal distance, return the lower of the two indices. If the value v does not occur at all, return -1.
It was very interesting to solve this problem. Give it a shot, you might also like it.

SublimeText 3/Anaconda error

When I installed Anaconda manually by downloading and untarring the file (as given in the manual installation instructions here ), I got th...