The 8 queens problem is a very popular puzzle especially for a Computer Science engineer. From the point of view of algorithms, there can be many approaches towards its solution. The problem statement and various solution approaches are mentioned below.
Sunday, June 6, 2010
Saturday, June 5, 2010
Friday, June 4, 2010
Problem: An array of size n contains integers between 1 to n. You have to determine if there exists an integer which occurs more than n/2 times in the array. Also, find the element. This is also called the majority problem. One more thing, the solution has to be done in linear time and using constant extra space.