Showing posts with label algorithm. Show all posts
Showing posts with label algorithm. Show all posts

Friday, June 8, 2012

List of Big-O for PHP functions


After using PHP for a while now, I've noticed that not all PHP built in functions as fast as expected. Consider the below two possible implementations of a function that finds if a number is prime using a cached array of primes.

Tuesday, June 5, 2012

Good Java graph algorithm library?


Has anyone had good experiences with any Java libraries for Graph algorithms. I've tried JGraph and found it ok, and there are a lot of different ones in google. Are there any that people are actually using successfully in production code or would recommend?

Tuesday, May 29, 2012

How to create a GUID / UUID in Javascript?


I'm trying to create globally-unique identifiers in Javascript. I'm not sure what routines are available on all browsers, how "random" and seeded the built-in random number generator is, etc..

Friday, May 25, 2012

Algorithm improvement for Coca-Cola can shape recognition


One of the most interesting projects I've worked in the past couple years as I was still a student, was a final project about image processing. The goal was to develop a system to be able to recognize Coca-Cola cans (note that I'm stressing the word cans, you'll see why in a minute). You can see a sample below, with the can recognized in the green rectangle with scale and rotation.

Wednesday, May 23, 2012

Friday, May 18, 2012

How does Facebook Sharer select Images?


When using Facebook Sharer, Facebook will offer the user the option of using 1 of a few images pulled from the source as a preview for their link. How are these images selected, and how can I ensure that any particular image on my page is always included in this list?

Wednesday, May 16, 2012

An intuitive understanding of heapsort?


At school we are currently learning sorting algorithms in Java and I got for my homework the Heap Sort. I did my reading, I tried to find out as much as I could, but it seems I just can't grasp the concept.

How to count string num with limit memory?


The task is to count the num of words from a input file.

Thursday, April 19, 2012

Sunday, April 8, 2012

javascript data structures library



I'd like to ask for recommendation of JavaScript library/libraries that supply an implementation of some basic data structures such as a priority queue, map with arbitrary keys, tries, graphs, etc. along with some algorithms that operate on them.





I'm mostly interested in:





  • The set of features covered,



  • Flexibility of the solution - this mostly applies to graphs. For example do I have to use a supplied graph implementation,



  • Use of functional features of the language - again it sometimes gives greater flexibility,



  • Performance of the implementation







EDIT





Ok, I'd like to point out that I'm aware that it's possible to implement using js the following data structures:





  • A map, if key values are either strings or numbers,



  • A set, (using a map implementation),



  • A queue, although as was pointed out below, it's inefficient on some browsers,







At the moment I'm mostly interested in priority queues (not to confuse with regular queues), graph implementations that aren't very intrusive as to the format of the input graph. For example they could use callbacks to traverse the structure of the graph rather than access some concrete properties with fixed names.



Source: Tips4all

Tuesday, February 14, 2012

Friday, February 10, 2012

Find duplicates in large file - java


I have really large file with approximately 15 million entries. Each line in the file contains a single string (call it key).