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)

4
votes
2answers
68 views

How do you avoid dominant solutions in multi-objective simulated annealing?

Imagine an RPG game were you can cary N items, and you want to maximise your damage, attack speed and armour, given a set of items. I implemented simulated annealing where a permutation simply ...
1
vote
1answer
146 views

Non-fixed-size Fenwick Tree implementation

I'm planning to implement a non-fixed-size Fenwick tree. That is, a Fenwick tree that allows interleaving range queries with adding/removing elements. All implementations and samples I've seen so far ...
2
votes
1answer
58 views

Algorithm for determining transactions among weekly data series?

I'm trying to develop a small reporting tool (with sqlite backend). I can best describe this tool as a "transaction" ledger. What I'm trying to do is keep track of "transactions" from weekly data ...
0
votes
1answer
105 views

Split multiple overlapping intervals to non overlapping intervals

currently I try to build an algorithm to split an array of overlapping intervals to a new array with non overlapping intervals. For example: Array of overlapping intervals: [ {0,7}, {8,12}, ...
-2
votes
0answers
49 views

Paxos consistency [migrated]

I'm looking at the paxos family of protocols for solving consensus in a network of unreliable processors. I'm working through scenarios where processors fail, and I know I'm wrong, but I don't know ...
-1
votes
0answers
94 views

How to triangulate a 3D polygon? [closed]

How can I create a set of triangles to fill a 3D polygon? The polygon is an ordered sequence of 3D vertices defining a single geometric contour (a closed path). Vertices are not necessarly coplanar. ...
1
vote
0answers
50 views

Detecting surface faces of a huge 3D mesh/grid

I've written a module in my application that creates a mesh from existing coordinate and face data. The number of vertices in the mesh could easily exceed 10 million and the same goes for the faces. ...
-1
votes
0answers
53 views

Backpropagation in layman terms [on hold]

I've been studying neural networks, and I'm beginning to understand the basics. I know what the backpropagation algorithm does. It feeds sample input and calculates an error against a given output. ...
4
votes
1answer
320 views

Efficient algorithm for Virtual Machine(VM) Consolidation in Cloud

PROBLEM: We have N physical machines(PMs) each with ram Ri, cpu Ci and a set of currently scheduled VMs each with ram requirement ri and ci respectively Moving(Migrating) any VM from one PM to ...
13
votes
6answers
19k views

Determining if an Algorithm is O (log n)

I'm refreshing my CS Theory, and I want to know how to identify that an algorithm O (log n) complexity. Specifically, is there an easy way to identify it? I know with O(n), you usually have a single ...
9
votes
2answers
516 views

Computer vision algorithms (how is this possible?)

I recently stumbled across a company that has created what appears to be a computer vision technology that is capable of detecting shoplifting automatically and alert its users. LINK Watching some ...
0
votes
0answers
22 views

Why does this code take up so much memory? [migrated]

I created a solution to this problem on leetcode: All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes ...
-3
votes
1answer
126 views

Any Deterministic Compression Algorithms out There? [closed]

The title says it all, basically. Are there any deterministic compression algorithms - that is, an algorithm which, given identical input, will always produce identical output? As far as I know, ...
-1
votes
1answer
117 views

Looking to calculate break even price (minus fees) on an individual level without brute forcing

I am trying to calculate the break-even price on an individual product given a percent of the price I sold it for and the price I bought it for. For example: I buy an item for $200 and the fees on the ...
1
vote
1answer
148 views

Grouping algorithm

We've developed an algorithm that depending on the check-in time of some workers and their living place, calculates the way to group them into some vehicles and the route which must be followed by the ...
0
votes
1answer
169 views

How does Luhn algorithm relate to cryptograpic hash functions?

What I am interested is the similarities and differences between the two. It is my understanding to present time that Luhn algorithm is a type of checksum function same as some cryptographic hash ...
10
votes
1answer
283 views

Fast indexing of k-combinations

I'm revisiting an old problem that I was working on some time ago. A typical scenario is "3 bits are set within an 8 bit integer", i.e. 00000111. All unique combinations with 3 set bits can easily ...
2
votes
2answers
101 views

Why use a unique hashkey for form submissions?

I have multiple forms and use AJAX to submit them. I asked my boss if he needed any specific format for the form ID and he told me to generate a unique hash and keep it in session; check it whenever ...
1
vote
0answers
28 views

How to split these products to packages? [migrated]

I have this group of products: Product Quantity Weight Per Unit pro#1 7 5kg pro#2 5 5kg I want to split these products into packages, but the ...
20
votes
4answers
1k views

Calendar/Planning algorithm

I'm facing a problem I'm not sure how to approach. I have to generate a calendar for employees, each of them having specific work constraints (some personal, some common) What I'm working with : I ...
0
votes
1answer
116 views

Measure and locate areas of similar value in an image

I saw this picture online and wanted to see if I could create an algorithm to give ordinary images an effect like this: http://justinlivi.net/wp-content/uploads/2011/01/Living_In_Digital.jpg My idea ...
-1
votes
3answers
111 views

How to smooth out a diagram? [closed]

we have a data set that creates a graph, it works but the graph has many up and downs and looks really bad, what I like to know if there is a known technique or algorithm or even an API that can ...
2
votes
1answer
91 views

Best-matching comparative values using all items in array

I have two arrays of objects (items) in the exact same format. Each item represents a wager, and each array represents one of two outcomes for that wager (ex: Team A vs Team B). Both arrays look ...
3
votes
3answers
73 views

Determine frequency-range that matches closest to input list of frequencies

Since this question is not about "code not working", I'm asking my first question here instead of StackOverflow. Inform me if any required information is missing from the question. Setup: I ...
0
votes
3answers
128 views

Analysis of insertion sort does not equal O(n^2)?

I'm learning more about algorithms and data structures. According to Wikipedia and other reliable sources, an insertion sort has a worst-case time complexity of O(n2). I'm attempting to measure that ...
2
votes
1answer
133 views

Figuring out the mean of a stream of data, disregarding values that are way off bounds

I have a stream of integer data and want to perform some statistical analysis on it. I want to calculate the mean and the standard deviation of it. So far it isn't hard, but keep in mind that I am ...
6
votes
3answers
442 views

How to extract the active code path from a complex algorithm

I have been puzzled lately by an intruiging idea. I wonder if there is a (known) method to extract the executed source code from a large complex algorithm. I will try to elaborate this question: ...
0
votes
0answers
58 views

Finding meeting point of Slow and Fast pointers in Linked List Loop

I am aware that the solution for finding a loop using Hare-Tortoise approach works. I have a working code that is able to detect loops in a Linked List. My question is on how to find the meeting point ...
4
votes
1answer
134 views

Image segmentation - show or hide clusters

I'm trying to make a small program in c#, that will downsample image to specified amount of colors (using K-means). Then, user will be able to hide\show colored areas(clusters) in image. I've ...
0
votes
0answers
43 views

Is there an algorithm to avoid getting in hundreds of datapoints from API to represent a bar graph?

I am showing a graph on HTML5 canvas using the flot charting library for a between a start date and an end date. It's fine as long as the period is less than a year or so but if the user selects a big ...
1
vote
2answers
202 views

Shuffle/Randomize a collection without knowing the number of items? [closed]

Let's say I have a sequence of items of unknown length, n. I want to randomize the order of this sequence without having to go through the entire sequence. Are there any algorithms that can do this? ...
3
votes
2answers
123 views

Work out which parcel deliveries we ship ourselves and which we outsource

Firstly, I hope I'm asking this in the right place. I work for a large online retailer in UK. We ship approaching 2000 orders each day and are growing very quickly. We currently use multiple delivery ...
0
votes
2answers
207 views

Min weight feedback edge set with DFS?

Exercise from The Algorithm Design Manual 6-10. [4] Let G = (V,E) be an undirected graph. A set F ⊆ E of edges is called a feedback-edge set if every cycle of G has at least one edge in F. ...
2
votes
1answer
149 views

Sorting a large number of unknown items with multiple stacks

Here is a problem I'm trying to solve for a personal project. I'm not exactly sure how best to even approach it. Problem: I have a single stack already populated with several thousands of unknown ...
2
votes
1answer
201 views

Is there a better algorithm to distribute integer to X integers minimizing their difference?

Is there a better algorithm to distribute values from one source to X destinations minimizing their difference? I have some source integer. I need to know how much of that value I need to distribute ...
2
votes
4answers
1k views

Is it possible to efficiently store all possible phone numbers in memory?

Given the standard North American phone number format: (Area Code) Exchange - Subscriber, the set of possible numbers is about 6 billion. However, efficiently breaking down the nodes into the sections ...
1
vote
0answers
71 views

Search algorithm on sequential data model

For sequential data models like LinkedList, search algorithms like linear-search and binary-search are well known. Are their any other search algorithms apart from these two, that work on sequential ...
2
votes
0answers
243 views

Fast fixed-size (256 bit) integer modulo/division

What is the fastest way to divide two 256-bit integers? They are represented as an array of 26-bit words, each stored in 32-bit integers. I have access to a 64-bit type if that's useful. It seems ...
2
votes
1answer
145 views

Finding the closest n points to any arbitrary point in two dimensions (r-tree, quadtree, spatial index)

I have a distribution of two dimensional point objects. How is it possible to find the nearest N number of points to any given point without iterating over the entire collection of points (and only ...
2
votes
2answers
92 views

Incorporating functions into a Shunting-Yard algorithm implementation

tl;dr What would be a simple way of incorporating functions into a Shunting-Yard algorithm implementation? If only expressions like function(arg1, arg2, arg3) were allowed (where function is some ...
18
votes
5answers
603 views

Algorithm for calculating a bullet path to a target with max. 2 ricochets

Sorry for the poor title but I didn't have a better way to phrase it... So there's this amazing game by Nintendo (yes!) on Wii called WiiPlay. There're 9 minigames in it, and my favorite one is ...
19
votes
4answers
3k views

When speaking, how can I say that the time complexity order of an algorithm is O(N log N)?

What term can I use to describe something with O(N log N) complexity? For example: O(1): Constant O(log N): Logarithmic O(N): Linear O(N log N): ?????? O(N2): Quadratic O(N3): Cubic
6
votes
2answers
584 views

Why would I care about the asymptotic growth of the lower bound of the worst case time/space?

In mathematics, there are notations for asymptotic lower bounds, upper bounds, and tight (within-a-constant-factor) bounds. When describing the growth of functions in general, it makes sense that all ...
2
votes
2answers
97 views

Algorithm to go from infix notation to a tree

I've been trying to figure out an algorithm to go from an infix equation to a syntax tree, like so: (1+3)*4+5 + * 5 + 4 1 3 However, I don't just want it to handle operators, I ...
9
votes
3answers
2k views

My algorithm that extracts the largest box that can be made from smaller boxes, is too slow

Imagine a cube based world (such as Minecraft, Trove, or Cube World) where everything is made up of identically sized cubes and all the cubes are of the same kind. The goal is to represent the world ...
4
votes
2answers
158 views

Merge directed acyclic graphs minimizing number of nodes

I have some DAGs (directed acylic graphs) and I want to merge them in order to minimize the number of nodes (we could say that every node has a cost, while edges are free). These four different DAGs ...
2
votes
3answers
2k 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
4answers
4k views

TEA algorithm constant 0x9e3779b9 said to be derived from golden ratio, but the golden number is 1.618?

I'm trying to understand a constant 0x9e3779b9. What kind of data is this? It's not binary, not decimal, what is this? It's a constant used on the TEA algorithm. It says it's derived from the golden ...
0
votes
0answers
53 views

Calculating audio delay to eliminate echo in VoIP

In this issue, the microphone at point A records audio, compresses it, and sends it to the server at point B somewhere "in the cloud." The point B server then figures out what rooms the recorded ...
2
votes
1answer
587 views

What is O(…) and how do I calculate it?

I've seen some questions here and on SO talking about the most efficient way to find or sort this or that. The questions usually talk about the efficiency of a certain algorithms in terms of O(...). ...