algorithm

Common algorithm question

Hello! Suppose we have some mesh (see the illustrating picture from CorelDraw, which uses the same technique in "Mesh fill" instrument). Obviously this kind of mesh is represented by a set of points and lines between them are actually determined using that set of points (probably somehow interpolated). This instrument also has button...

Genetic Algorithm open source library with all the trimmings e.g. cellularGA features

Hi, I would like to implement a GA-based feature selection program for an SGI UV system (cores=512, shared memory=4TB) which operates as thus: (Feature selection is the process by which the smallest subset of original features is found which makes discrimination between the output classes better than using the original set of features-or...

Finding closest neighbour using optimized Levenshtein Algorithm

I recently posted a question about optimizing the algorithm to compute the Levenshtein Distance, and the replies lead me to the Wikipedia article on Levenshtein Distance. The article mentioned that if there is a bound k on the maximum distance a possible result can be from the given query, then the running time can be reduced from O(mn)...

Algorithm for seating groups of people?

I'm interested in writing an application that can determine how to seat groups of 2-10 people at tables that can hold 10 people. There will probably be about 15 tables and 140 people total. I don't want to break up any of the groups of people. It seems like it might be a common problem and I was wondering if anyone had any suggestions...

Regular expression generator/reducer?

I was posed an interesting question from a colleague for an operational pain point we currently have, and am curious if there's anything out there (utility/library/algorithm) that might help automate this. Say you have a list of literal values (in our cases, they are URLs). What we want to do is, based on this list, come up with a sing...

recommended data structure while designing something like a dictionary?

Is TRIE the most recommended data structure while designing something like a dictionary for storing words? Any other alternatives that improve either the time or memory performance? I believe a hash may be good if there's no collision but then memory requirements start getting bad for overlapping words: over, overlap, overlaps, overlap...

Help with the calculation (and usefulness) of password entropy

This is a two part question: Part 1 First, dealing with calculating the entropy of a password in PHP. I have been unable to find any code examples that are empirically sound and would really like some help in finding the 'right' way to calculate a final number. A lot of folks on the net have their own home-baked weighting algorithm, ...

Need help with credit expiration algorithm

So I'm stuck. I am working on a credit system with expirations. Similar to credit card miles but not exactly. By the way I am sorry for the book ahead but I needed to add enough detail to help get the whole picture. What I need is a system where a user accumulates credits for doing activities. But they can also spend these credits on ac...

Fastest way of doing transformations (Move, Rotate, Scale)

I was looking at this vector drawing application called Creative Docs .Net . I noticed that I can have hundreds of shapes and moving, rotating and scaling do not lag at all. Given that all verticies must be modified, how do applications generally do these transformations as quickly as possible? Thanks ...

Algorithm to divide a rectangle to smaller retangles?

What's the algorithm to divide a rectangle (c struct with 4 ints) to a random number of smaller rectangles (return a list of structs)? Even better if the max and min dimension of the smaller rectangles can be controlled by a parameter. e.g. +----------+ +-------+--+ | | | | | | | ...

Algorithm for almost similar values search

I have Persons table in SQL Server 2008. My goal is to find Persons who have almost similar addresses. The address is described with columns state, town, street, house, apartment, postcode and phone. Due to some specific differences in some states (not US) and human factor (mistakes in addresses etc.), address is not filled in the s...

4-bit ECC algorithm

Can anyone give a reference for a 4-bit ECC algorithm? I need to implement one for an embedded Nand Flash driver. ...

LZW compression/decompression under low memory conditions

Can anybody give pointers how I can implement lzw compression/decompression in low memory conditions (< 2k). is that possible? ...

An algorithm to solve a simple(?) array problem.

Hello! For this problem speed is pretty crucial. I've drawn a nice image to explain the problem better. The algorithm needs to calculate if edges of a rectangle continue within the confines of the canvas, will the edge intersect another rectangle? We know: The size of the canvas The size of each rectangle The position of each recta...

With respect to an array containing a lot of duplicate elements, is there any operations to improve the performance of normal binary search?

With respect to an array containing a lot of duplicate elements, is there any operations to improve the performance of normal binary search? ...

search algorithm on large files

I need help in deciding with search algorithm to use for searching large files. here is what I am doing. Lets say file consists of time range t1 to t2. (t2>t1) I need to get file offsets (fseek) of: time t3 that is bigger than t1 time t4 that is smaller than time t2 | ------| ---|----------------| t1 t3 t4 t2 ...

An onsite implementation question from a startup.

The system maintains a table with 150 pages, and each page contains 1.5 million records hashed with users’ birth date. Each record includes information of username, nickname, birth date, hometown and title. We are required to write a C++ program that transforms this table into another one, which has 100 pages and is hashed with username....

Algorithm for text selection intersection

I have a website that allows multiple users to highlight multiple parts of a html document (mostly text). Each highlight is marked by the start, character position, length and user id. I need to find out the most highlighted sections (most overlapped sections), however different users might not have the same start and end position. Wha...

Range intersection / union

Hello, I'm developing a programming language for which I want to provide a Range data type which for now is, not as usually, a list of pairs of int values (x,y) with the constraint that x < y. I say not as usually because usually a range is just a pair but in my case it is more than than, allowing to have for example 1 to 5, 7 to 11, 13...

skyline algorithm

How do I find the vertices of the broken line that surrounds the silhouette in this image? A possible input for the example above is: WIDTH HEIGHT POSITION 3 9 17 5 9 9 12 4 8 3 11 3 10 7 1 2 3 19 So for this example the solution would be [(1, ...