8 Queens on A Chessboard

Image

Image Placing 8 Queens on a chessboard is a classic problem and is one of the good software interview question. Following code is my take on this problem. Though instead of starting queen placement at predefined position (at 0,0 or at a corner), 1st queen placement in first row can be specified by user. Discussion/Comments are welcome, please click here to go to discussion forum.

An fun webpage is created with CGI/PERL script where above algorithm can be seen in work. Please go here to experiment with the algorithm.

Continue reading “8 Queens on A Chessboard”

If A Number is An Exact Power of 2?

reply.gif

reply.gifDetermining if a number is power of two, is very old design problem. Various solutions to this already exists but performance of these solutions is evaluated based on software requirements only. But normally efficiency of algorithm depends on means to deliver it, Hardware performance is evaluated here for three such algorithms and shown that there is stark gap between software performance and hardware performance. Hardware evaluation parameters are also briefly discussed (from ASIC design Flow point of view). Towards the end, a noble method is proposed & evaluated to determine if number is power of 2. 

Continue reading “If A Number is An Exact Power of 2?”

Location of Most Significant ‘ON’ Bit

reply.gif
reply.gifKnowing location of most significant bit in a given number has lots of application in Hardware, mainly in packet priority queueing. Easy way to determine this is to put a simple priority encoder but performance of this solution is not very good. In the Article, one more implementation is presented with better performance.

Continue reading “Location of Most Significant ‘ON’ Bit”