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
1answer
160 views

Optimal fixed-size sequential sorting algorithms

I have been working on sorting algorithms for a few weeks now, but one of my question still hasn't an answer: are there optimal sequential comparison sorts for fixed-size – and random-access – ...
1
vote
1answer
272 views

Generating combinations algorithmically

Suppose I have an n-high pyramid of numbers like: 1 5 8 2 5 4 8 9 3 1 2 8 3 7 2 How can I algorithmically walk through every possible path from the top of the pyramid to the bottom? To ...
3
votes
2answers
75 views

Algorithm to identify degree of similarity based on prior categorization

I am working with digital images that people have manually categorized on a number of parameters. I want to be able to find images that are similar or dissimilar based on certain categories. For ...
1
vote
1answer
96 views

Algorithm for optimized variable generation without collisions?

I'm looking for an algorithm that can generate optimized syntactically valid variable names (for javascript in this case) without collisions. So as general rule I would want something that generated ...
3
votes
2answers
187 views

Big O Nested For Loop Breakdown

I understand how to get a general picture of the big O of a nested loop, but what would be the operations for each loop in a nested for loop? If we have: for(int i=0; i<n; i++) { for(int ...
2
votes
1answer
190 views

How do you calculate affinity in Edge Rank/Activity Streams

I have been researching how to build a newsfeed that sorts the order by relevancy. I have been following along Facebook's Edge Rank and Etsy's Activity Feed Architecture and I can't figure out how ...
0
votes
1answer
104 views

Finite Element Shader

I am working on a geometric wrapper for a space jet exhaust impingement solver. A key part of the solution is determining what the jet can "see" and therefore hit. My model is grouped with nodes or ...
1
vote
0answers
31 views

Matching data based on multiple parameters and certain limits

I've been looking into the k-nearest neighbors algorithm as I might be developing an application that matches boxers in the near future. The reason my for question, is to figure out which would be ...
-2
votes
1answer
60 views

Computer Algorithms for Polynomial Regression [closed]

Given a data set of arbitrary size, what algorithm would be appropriate for performing the polynomial regression on the data set such that the highest degree of the polynomial is n? If there are ...
5
votes
1answer
146 views

Algorithm for predicting outcome based on parameters

I've never done anything with statistics, so I'm unsure of how to start with this problem that I need to solve for some software that I'm working on. Basically, there are three parameters An ...
1
vote
0answers
45 views

Recursive(?) algorithm design help

I have a requirement to allow my end users to input formula much like a spreadsheet. I have an array like this: $table = array( 1=>array( "id"=>1, ...
3
votes
2answers
79 views

Sparse set lossy compression algorithm

I am looking for algorithm or idea for the following problem. Suppose we have a data type, say 64-bit integer. Now we have a relatively small set of such items, say few hundred at most. The simplest ...
4
votes
1answer
111 views

Sentence Word-Grading Algorithm

I need an algorithm to detect incorrect answers in memorization of sentences. Confused? Let me show you. I need to repeat the following sentence by memorization: The quick brown fox jumps over the ...
2
votes
1answer
74 views

How to test the best combination of ratios to fit inside an overarching ratio?

We have a problem we are trying to solve where we have a number of different containers. Each container can hold a number of different items (call them "item A" through to "item H"). Each container ...
2
votes
1answer
185 views

Dependency ordering algorithm of a compiler

Let's say, hypothetically, I'm writing a Java compiler. And we assume that in my case a class can't be fully compiled until all signatures of dependencies (imports and other used classes) are known. ...
1
vote
1answer
44 views

How an add vertex operation could be performed in constant time for a graph represented using adjacency list?

Adding a vertex in a graph that is represented using an adjacency list takes O(1) time complexity according to http://bigocheatsheet.com/ (graph operation > adjacency list > add vertex). It is said ...
3
votes
1answer
140 views

why adding a vertex in a graph represented using an adjacency matrix takes O(|v|^2) time complexity?

Adding a vertex in a graph that is represented using an adjacency matrix takes O(|v|^2) time complexity according to http://bigocheatsheet.com/ (graph operation > adjacency matrix > add vertex). But ...
2
votes
1answer
80 views

Time slot generation based on available technicians

Consider an Organization which provides technicians for different types of jobs. Each job type varies in completion time and technician count. For e.g., Job type 1 requires 2 technicians and 1 hour ...
0
votes
0answers
96 views

Algorithm to maximize pairwise comparisons using transitive property

I'm looking for some direction on building an algorithm that will maximize the number of pairwise comparisons of objects in a set using transitivity. To explain in detail: Suppose there are x ...
2
votes
0answers
89 views

Creating a better mouse dragger function

I originally posted this to code review, not knowing incomplete code was off-topic and was pointed to post here. I don't believe this question is a good fit for stack overflow because the code I ...
5
votes
3answers
545 views

Is O(log n) + O(log n) = O(n)? [duplicate]

We know that binary search takes O(log n) in Big O notation but if we need to run twice an algorithm of O(log n), would it be the same as O(n) in time complexity? For example, if I have a method to ...
4
votes
1answer
62 views

Can edit distance be used in a simple fashion to restrict editing to spelling mistakes only?

For a small hobby project I thought about giving users the ability to edit their submissions, but, since their submissions will be voted on by other users, restrict editing to correct (minor) spelling ...
4
votes
3answers
2k views

Why is mergesort O(log n)?

Mergesort is a divide and conquer algorithm and is O(log n) because the input is repeatedly halved. But shouldn't it be O(n) because even though the input is halved each loop, each input item needs to ...
0
votes
1answer
95 views

What does “amortized” mean in “amortized analysis” of algorithms? [duplicate]

"amortize" mean reduce or extinguish (a debt) by money regularly put aside. i.e. to pay off of debt with a fixed repayment schedule in regular installments over a period of time. In amortized ...
1
vote
1answer
126 views

Find all the pairs in the array that match the condition

Problem: We have an int array[n]. We need to find all the pairs for which array[a] + array[b] = 0. The only algorithm I came up with so far has O(n^2) - tho most obious one. Is there a better way ...
-2
votes
2answers
390 views

Difference between O(N^2) and Θ(N^2) [duplicate]

What is the difference between O(N^2) and Θ(N^2)? I know that O is the upper bound and Θ is tight bound. Could someone explain me this concept with an example.
-1
votes
3answers
347 views

What is O(m+n) and O(m*n) in Big O notation? [duplicate]

I understand that O(n) describes an algorithm whose performance will grow linearly and in direct proportion to the size of the input data set. An example of this is a for loop: for n in 0.100 puts ...
-2
votes
1answer
183 views

3D visualization of moment using accelerometer on Android device [closed]

Is it possible to reconstruct the movement of an Android device in 3D space using data from accelerometer? For example, I may draw a circle with my hand in the air, holding an Android device. Is ...
3
votes
2answers
191 views

How to find the closest right neighbour in a tree?

Given a class: public class Node { public List nodes[]; public Node right; //NULL for now } What's the best way to fill the "right" element of all tree nodes? N ...
5
votes
6answers
390 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 ...
4
votes
1answer
152 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. ...
-3
votes
1answer
157 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
129 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 ...
0
votes
1answer
254 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 ...
4
votes
2answers
83 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 ...
2
votes
1answer
371 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 ...
20
votes
4answers
2k 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 ...
-1
votes
3answers
126 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 ...
3
votes
3answers
121 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
224 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
153 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 ...
0
votes
0answers
160 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 ...
0
votes
2answers
95 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
225 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? ...
1
vote
0answers
89 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
1answer
219 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
2answers
136 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
754 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 ...
2
votes
2answers
126 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 ...
0
votes
0answers
95 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 ...