Showing posts from July, 2012

Binary search

When we are looking in a sorted list, we are looking for which part of the list begins with the character we want. This technique can be implemented in Perl known as binary search, because we divide the list in two pieces after each look. We are starting in the middle of the list and we check if the current word is lower or greater than the word we are looking for. If it is lower, we are going in the middle of the bottom half of the list, if it is higher, we are going in the middle of the top half of the list, and we are continuing the process, dividing the list in halves until we find the word we are looking for, or we are out of the list. This process is faster than linear searching because we skip quite a lot of words in large arrays. The biggest drawn back is that the list must be sorted, but this is fine if we sort the array once and then we make multiple checks to see if some words exists inside the list. This algorithm is best suited to look for some lines in a very large a


After a pretty long vacation, I'm back with some news :) I created this Perl module to use it for  menutray , fbmenugen and obmenu-generator . It requires the  Module::Build  for installation. It has been designed to be very fast and pretty easy to use. It parses the *.desktop files and returns a Perl data structure with the information required. It offers many configuration options (see the man page or the source code). It works only on Linux with a version of perl>=5.14.0; Download: