algorithm

How to compute the absolute minimum amount of changes to convert one sortorder into another?

Goal How to encode the data that describes how to re-order a static list from a one order to another order using the minimum amount of bytes possible? Original Motivation Originally this problem arose while working on a problem relaying sensor data using expensive satellite communication. A device had a list of about 1,000 sensors th...

Practical Uses of Fractals in Programming

Fractals have always been a bit of a mystery for me. What practical uses (beyond rendering to beautiful images) are there for fractals in the various programming problem domains? And please, don't just list areas that use them. I'm interested in specific algorithms and how fractals are used with those algorithms to solve something in pr...

How to walk two arbitrarily complex tree structures simultaneously and create a superset?

I have two tree structures that represent snapshots of a directory structure at two different points in time. Directories may have been added, removed or modified between the snapshots. I need to walk the two trees simultaneously and mark the newer with the differences between the two - i.e. flag nodes as New, Modified, Deleted, Unchange...

randomize NSArray

I need to randomize an NSArray that I have loaded with quiz questions, but I need to keep the elements in a specific order. ...

Challenge,how to implement an algorithm for six degree of separation?

UserA-UserB-UserC-UserD-UserF Users connected by '-' know each other. And I need an algorithm for these 2 tasks: Calculate the path from UserX to UserY For UserX,calculate all users that is no more than 3 steps away. Is there an efficient solution? EDIT My purpose is not to prove it right or wrong,but to calculate the result real...

J2ME power(double, double) math function implementation

Hi! I want to implement math function power to double, can you advice algorithm for this? I've reviewed sources of Java ME Open Source Software - Math but I want to implement it from the scratch. Thank you! ...

Which Mathematics should I study to be a better programmer/developer?

Possible Duplicates: How much mathematics and physics should a programmer know? What are the core mathematical concepts a good developer should know? I would like to study mathematics to be a better programmer (Web Developer) but which maths should I study e.g. Algebra, Calculus, Discrete Math etc? I plan to work with Algori...

The best distribution of cameras inside a room

Hello, my problem is to cover 100% of the room with cameras in 2D. The camera can be modelled as a polygon. I am finished with all the modelling and necessary tools. My problem is with the algorithm. The complexity of blind search for a big room with many obstacles will be too high. So does anyone know a better (or optimal) algorithm?...

Optimize a list of text additions and deletions

Hello, I've got a list containing positions of text additions and deletions, like this: Type Position Text/Length 1. + 2 ab // 'ab' was added at position 2 2. + 1 cde // 'cde' was added at position 1 3. - 4 1 // a character was deleted at position 4 T...

How to spread processes over time getting minimum number of "collisions"

I'm developing a scheduler for an embedded system. This scheduler will call each process every X milliseconds; this time can be configured separately for each process, of course. Everything is coded and calls every process as it should; the problem I'm facing is this: Imagine I set 4 processes to be called every 10, 15, 5 and 30 millis...

Algorithm to implement a lasso selection tool?

I am developing a Mac OS X application which, as part of it's UI, will display many visual elements in it's main view which can be selected. These elements can be positioned really anywhere within the view. The UI will support various ways of selecting the elements: rectangular marquee selection, elliptical marquee selection, and 'free' ...

Web mining -classification algorithms

Hi, my senior project is determining the dominant category of a web page.I crawled dmoz. now i am trying to build arff. After that i will use some feature extraction methods and classification algorithms. Do you know which feature extraction method performs good with any classification algorithm for web mining? ...

Number of possible outcomes for 2 numbers given that one number is greater than the other

I am trying to write an algorithm to calculate outcomes. But I need help with combinatorics. Suppose I have to choose 2 numbers from 1 to 10. From the fundamental rule of counting, in the absence of any restriction, the number of possible outcomes is 10 * 10 = 100. (10 possible outcomes in choosing the first number x 10 possible outcom...

PHP: How to sort values of an array in alphabetical order?

I want to sort values of an array in alphabetical order in PHP. If all values started with same character then they should be sorted using second character and so on. Ignore case sensitive. For Example: before: values[0] = "programming"; values[1] = "Stackoverflow"; values[2] = "question"; values[3] = "answers"; values[4] = "AA Systems...

Multiple Origins - Multiple Destinations

I either have a blonde moment or am attempting something a bit out of my league, but here it goes ;) I have an optimization question. It is only somewhat traveling-salesman-ish. Lets say I have a set of destinations and another corresponding set of origins. I need to link each destination with one origin so that the variation between...

Why does this flood-fill algorithm cause a stack overflow?

void FloodFill(int layer, int x, int y, int target, int replacement) { if (x < 0) return; if (y < 0) return; if (x >= _mapWidth) return; if (y >= _mapHeight) return; if (_mapLayers[layer, x, y] != target) return; _mapLayers[layer, x, y] = replacement; FloodFill(layer, x - 1, y, target, replacement); Flo...

Binary Search Tree - node deletion

I am trying to understand why when deleting a node in a BST tree and having to keep the children and adhering to the BST structure, you have to either take the node's right child (higher value, then node being deleted) and if that right child has a left child take that child. Else just the the node being deleted right child. Why don't ...

WIN32 Audio Sample Rate Conversion

Under WIN32, One may use the acmStreamConvert function as an audio sample rate converter (for example, converting 44.1kHz to 48kHz audio stream). According to Secret Rabbit Code documentation, the quality of a sample rate converter is measured by it's Signal-to-Noise Ratio and Bandwidth. Secret Rabbit Code claim "signal-to-noise ratio...

Experience with Association Rules and Frequent Itemsets

Has someone ever used some of these Algorithms ? What for ? ...

Is there any Algorithm for converting Image of sound to sound?

So I have an image like this Is there any algorithm to extract (get as PCM) sound from which was created that image? ...