Skip to main content

Posts

Showing posts with the label algorithm

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?

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

Common sequences in two strings [closed]

I am looking to find all common sequences of works between two strings. For example: String A: A, B, 1, 2, 3, 4, 5, X String B: 1, 2, 3, 4, A, B, C The common sequences here would be A, B & 1, 2, 3, 4 I am looking for a Java solution which will do this. Thank you very much

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). I need to find the duplicate entries in the file using java. I tried to use a hashmap and detect duplicate entries. Apparently that approach is throwing me a "java.lang.OutOfMemoryError: Java heap space" error. How can I solve this problem? I think I could increase the heap space and try it, but I wanted to know if there are better efficient solutions without having to tweak the heap space.