In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. Algorithms are used for calculation, data processing, and automated reasoning.

learn more… | top users | synonyms (1)

1
vote
1answer
61 views

Efficient algorithm for joining sieves

I'm trying to find an efficient algorithm for the following algorithm. I have a sequence consisting of lists of indices denoting indices to be removed. The semantics are such that each sequence must ...
3
votes
4answers
170 views

Building complex algorithms with TDD

I'm trying to adopt TDD in my daily programming practice. I use it at work very effectively, but I'm having trouble with my personal projects where I'm using some complex algorithms. The particular ...
0
votes
2answers
215 views

Algorithm to order array

Take for example this input array: [2,7,1,4,9] For this input, I need to produce an array of total 23 elements which contains two elements of 2, seven elements of 7, one element of 1, four elements ...
3
votes
1answer
75 views

Which machine learning approach should I look into? [closed]

Consider an application in which users fill out a form of (six or so) inputs and are offered widgets from an inventory based on their inputs; from the widgets they are offered, they must select one ...
0
votes
0answers
29 views

Algorithm for HIghest Local Alignment Score with a specific character match between two subsequences

I'm writing a code that identifies the highest-scoring local alignment between a substring X' of X and a substring Y' of Y that has at least one column in which a C from X' is aligned to a W from Y'. ...
0
votes
3answers
118 views

Least Change Problem with Thousands of Denominations

In a hypothetical economy there are currency units that can represent thousands of different values. So, for example there might be coins worth 1c, 3c, 5c, 7c, 7.5c, 80c, 8001.5c etc. Given a list of ...
0
votes
0answers
33 views

Looking for a Treemap tiling algorithm

I'm looking for an algorithm to convert a tree of data into a 2 dimensional treemap view. http://en.wikipedia.org/wiki/Treemapping I can do all the coloring in and drawing myself, but if there was ...
1
vote
2answers
118 views

Approach to coding algorithms to minimize rework [closed]

I find myself reworking my code quite a bit, especially when learning to write algorithms that involve keeping track of multiple attributes and labels. I feel that having the pseudo-code written up, ...
1
vote
1answer
46 views

Algorithm for detection of overlapping between vectors

I am currently developing a math-physics program and I need to calculate if two vectors overlap one another, the one is vertical and the other is horizontral. Is there any fast algorithm to do this ...
0
votes
0answers
61 views

How to Detect Sprites in a SpriteSheet?

I'm currently writing a Sprite Sheet Unpacker such as Alferds Spritesheet Unpacker. Now, before this is sent to gamedev, this isn't necessarily about games. I would like to know how to detect a sprite ...
3
votes
1answer
58 views

Applying the Art Gallery problem to optimal sensor placement

I am trying to design an algorithm for optimal sensor placement in a given area. After doing some research I found the Art Gallery Problem. However, this problem assumes that the guards can see all ...
1
vote
1answer
95 views

Memoization Memory

Memoization is definitely a powerful technique. But Dynamic Programming is slightly better IMO, since it does not involve the memory strain (in a recursive program, the parameters occupy memory and ...
0
votes
0answers
144 views

what is the meaning of f(n) = O(g(n))? [duplicate]

I am reading 'Algorithm design manual' book by Steven S. Skiena. I would like to know what is f(n) and g(n)? I am a programmer and wanted to gain more knowledge about algorithms but now I am confused ...
7
votes
4answers
697 views

Apple eating problem

Player A and Player B play a game. On the middle of the table there is a pot full of N apples of different weights. Player A starts first and choose an apple and start eating it. Losing no time player ...
1
vote
0answers
27 views

Colour curves tool for “value” channel

I'm trying to write a program to read GIMP curves files and apply them to an image. I have successfully implemented the curves for the red, green and blue channels, but I can't get it working for the ...
2
votes
1answer
90 views

Programming conundrum - most efficient path

I have a non-language-specific problem which I'm having trouble finding a workable answer for. I have a 10x10 grid containing integer values from 1-10. Each value represents the cost of travelling ...
5
votes
1answer
75 views

Coming up with a valid ranking algorithm for articles

I'm creating a website which will publish one or more articles a week. I'd like to be able to rank the articles based on popularity. In order to do this, I need a formula to calculate a score for ...
0
votes
2answers
111 views

How to draw a spiral using segments of varying circles?

I have an old plotter that can't handle printing true spirals. I need help with developing an algorithm to approximate a spiral. Here's a LISP sub-script that I have written which uses semicircles ...
0
votes
0answers
39 views

Algorithm for Testing interoperability

I am writing a php script that carries out a task. One input is a list of options that I need to test for interoperability. If the options are A B C then I need to test every combination, but I only ...
2
votes
2answers
145 views

Is there any use for a smart algorithm developer who will delegate the coding?

In my job as an algorithms developer, I am responsible not only for developing algorithms, but also for implementing them, all the way down to writing the code that goes into production. I've heard ...
1
vote
2answers
102 views

Algorithm for searching images within images [closed]

I can't google this question, because I can't come up with a good query, so let me describe what I want and maybe someone will be able to suggest a way forward for me. I need to solve the following ...
3
votes
3answers
373 views

Is it better to use a switch statement or database to look through 5,000 to 10,000 instances?

I have some JSON data in this format (5,000 instances for now): {"id":"123456","icon":"icon.png","caseName":"name of case"} I am allowing the user to search for the name of the case and then return ...
1
vote
1answer
17 views

Given n distinct keys, how many different 2-3/Red-black trees can be constructed?

Memory refresher/My understanding: A 2-3 tree is a balanced search tree that allows two types of nodes. 2-node: Normal node with two children. LChild < Parent and RChild > Parent 3-node: ...
0
votes
4answers
276 views

Binary Search seems superior, why did the committee of C++ still have Find in the algorithm library?

I wish to search for an integer in a vector of integer. I have two candidates for the job: Binary Search Find It seems that Binary Search is the best candidate for the job as although I have to ...
0
votes
3answers
130 views

Sorting an array when values are decreased by each swap [closed]

Recently in an interview I come across a question: We have an unsorted array, we need to sort it with minimum number of swap. We have in sort a 'tax' of 1 is deducted from the number we are ...
0
votes
0answers
76 views

Storing simple / flexible pricing logic in the database

I am working on a pricing algorithm where I want to generalize the calculation of certain components/charges. There are 3 components to the charges. 1 - a basic/core charge, 2- a handling charge ...
0
votes
1answer
139 views

Find possible variations of one item out of multiple baskets.

I have three baskets of balls and each of them has 10 balls which have the following numbers: Basket 1: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Basket 2: 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ...
2
votes
2answers
235 views

Is Pre-Order traversal same as Depth First Search?

It seems to me like pre-order traversal and DFS are same as in both the cases we traverse from root till the left branch and back to root and then to the right branch recursively. Could any please ...
3
votes
1answer
224 views

What are the essential mathematics topics that a programmer should know in order to learn algorithms? [closed]

Being a electronics engineer, I was never exposed to any algorithms. Now I am a experienced programmer and want to learn Algorithms. I started with CLRS. But I was overwhelmed by the maths in the ...
0
votes
1answer
54 views

Even distribution through a chain of resources

I'm working on an algorithm which routes tasks through a chain of distributed resources based on a hash (or random number). For example, say you have 10 gateways into a service which distribute tasks ...
1
vote
1answer
51 views

Finding minimum path with return?

I'm having trouble understanding a past quiz question I got: Bobby works at Starbucks in San Mateo (V). He is doing quality assurance testing and needs to visit stores in Palo Alto (B), Tenderloin ...
3
votes
1answer
105 views

Need an optimization algorithm

I need this algorithm for one of my projects. I will paraphrase the problem. There are 'n' ropes that have different colored rings on them. (The colors might repeat on the same rope or across ...
0
votes
1answer
60 views

What algorithm pairs blocks so that the weighted average of the two blocks falls within an upper and lower bound?

What algorithm would pair parcels with a high proportion of property x to a parcel with a low proportion of property x so that the weighted average of the two parcels falls within an upper and lower ...
-2
votes
4answers
122 views

Algorithm/research on detecting language of text [closed]

I am interested in finding an approach that will detect what language a string of text is. As Google translate does.
2
votes
4answers
276 views

difference between exponential and logarithmic growth

Why for(k=1;k<=n;k*=2) grows logarathmically = O(logn) but I feel it grows exponentially, as the seq look like 1,2,4,8.... and for fibonacci series people say it grows exponentially. which for me ...
3
votes
3answers
78 views

Detect Order Changes in a List

Let's say you have a list of values that are a b c d e The order on the list might be changed. a c d b e How would you detect this change? We needed something like this when we were ...
0
votes
3answers
96 views

How to limit time period to another period?

For a project planning I have an initial period, lets call it PPStart-PPEnd. The planning is associated with a project. This also has a period PrjStart-PrjEnd. PrjStart and PrjEnd are fixed, and can ...
0
votes
0answers
47 views

Distributing Contestant Entries Between Multiple Bins, Is this Knapsack?

I am an algorithm novice and am faced with a rather difficult problem. I working with contest's. There are contestant - individual player entry - contestants can have multiple entries into a ...
3
votes
4answers
265 views

Which mathematical properties apply to XOR Swap algorithm (and similar bitwise operator algorithms)?

Assume you have two variables a and b, and you need to swap them, and for whatever reason, making a temporary variable for storage is not an option. This is the algorithm in pseudocode a ← a XOR b b ...
1
vote
1answer
60 views

Mapping values over a curve

I have a value between 0 and 8000 and I want this number to resolve to another number between 0 and 2000. I could just divide it by 4 but I have a special need here. For values above 4000 I want the ...
0
votes
5answers
239 views

Mapping 40 unique integers to 41 and back

This was a question proposed by a friend of mine. Define an algorithm that, given 40 unique integers in the range 1-1000, returns 41 unique integers in this range. Given these 41 integers, we must ...
-1
votes
1answer
103 views

Possible number of combination for SSNs [closed]

The SSNs or Social security numbers having the range {0,1,2,3,4,5,6,7,8,9}, as the conditions are-> 'o' cannot be the first number for an SSNs, -> repetition of number is possible, ...
1
vote
2answers
64 views

How to reduce close points

input: C matrix 2xN (2D points) output: C matrix 2xM (2D points) with equal or less points. Lets say we have C matrix 2xN that contains several 2D points, and it looks something like that: What we ...
0
votes
1answer
54 views

expressing the speed of a sorting algorithm

How would I express the speed of the following sort algorithm? I know bubblesort is n^n (er, I mean n^2...as someone pointed out below). In the following the array decreases each time you call it ...
1
vote
0answers
110 views

What is the purpose of chunking strings in natural language processing?

I see many examples of libraries that use a 'chunker' and also people asking how to write chunkers, but what is this for and why do we need it? Isn't it enough to split a text by whitespace or other ...
1
vote
0answers
68 views

R* Tree work with dynamic data

I'm searching an algorithm to store my data (which are moving objects' coordinates) and allow me to query objects within a specific radius of a specific point. I came up with R* Tree which is said as ...
2
votes
0answers
129 views

Match buyers and sellers based on date ranges and quantity of shares

NOTE: This is in reference to the question I asked on Stack Overflow but was told to post this here I'm building a trading application that matches buyers/sellers that own subscription. Subscriptions ...
1
vote
0answers
102 views

Is that concept of securing connection between telephone and server makes sense [closed]

This topic is on concept level right now. I know that you like straight-forward questions, but I really need an expert look on all of this. (I am still a student, this is not commercial by any means) ...
6
votes
3answers
167 views

Maximizing number of nested triangles

There is a finite set of points on a plane (about 1500 points in the current task). I need to construct triangles on those points such as each triangle lies completely inside one larger triangle: ...
2
votes
0answers
73 views

Solving geometric constraints with Minion

I am doing research on squares, and I thought of using constraint-satisfaction-problems solvers for proving or disproving some conjectures. As a simple example problem, consider the following task: ...