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
68 views

Kth selection routine - Floyd Algorithm 489

I have recently come across a promising Kth selection routine that reportedly outperforms quickselect the Floyd, Rivest Select routine. This Wikipedia article provides a pseudocode version which I ...
-2
votes
1answer
17 views

Proving that each element in reservoir have equal probability of been selected in reservoir sampling?

Here is the proof After the (i-1)th round, let us assume, the probability of a number being in the reservoir array is k/(i-1). Since the probability of the number being replaced in the ith round is ...
-4
votes
0answers
23 views

Algorithms with natural language [on hold]

I am building a web app where people can post their problems in 140 character length and the most common problem will be outputted in a list. To determent the most common problem, the app must match ...
-1
votes
0answers
25 views

Detecting similar sets

I have a set S consisting of N sets, each containing 2 or more numbers. E.g.: S={{1,2,6},{6,3,4,2},{6,2},{1,9,12},{7,8,13}}. So, here N=5 The question is: Determine which sets should be grouped ...
0
votes
1answer
22 views

Avoid numeric errors in Naive Bayes method

I am implementing the Naive Bayes method with Gaussian distribution. The problem that I have is that the variance used on the Gaussian curve (calculated from a training set) is REALLY small. They ...
0
votes
3answers
51 views

Algorithm to generate parallel path inside polygon

A path is defined as a list of 2D points (x,y) (and may be open or closed). Given a path p, what is an algorithm which generates a path p' which is "inside" p and at constant offset to p i.e. each ...
3
votes
1answer
105 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 ...
3
votes
3answers
117 views

How to determine if set of ordered coordinates form a simple curve?

I hope it is the right place to ask this. I wasn't sure if it belongs to Stack Overflow or Computer Science. Eventually this seemed more suitable. Anyway, some background first: A closed curve, is ...
2
votes
2answers
172 views

How to iterate between these elements

I have an array of elements: int[] elem = new int[] {A, B, C}; I need to calculate the sum of ALL the combinations of those elements, where only some of the elements can be optionally selected. I ...
-1
votes
0answers
24 views

algorithm to find lowest-weighted sub graph [on hold]

It's a question I read it in a book but I couldn't solve it. Give an algorithm to find the lowest-weighted sub graph that maybe its edge weights lower than zero. algorithm should be in O(E logV)
-2
votes
0answers
22 views

Persist and sync custom sorting information [on hold]

Assume a task app like asana with multiple client apps and the data must be synced across multiple systems. I have a list of 'tasks' and they can be custom sorted. What is the optimum way for me to ...
1
vote
0answers
128 views

What AI algorithm should I use to develop an automatic personal scheduler?

In a project that I'm doing for my Artificial Intelligence course, I'm developing a software for automatic personal scheduling. The user tells the software what tasks he has to perform (along with ...
-1
votes
0answers
61 views

Algorithms to find probable lines given a set of dots? [on hold]

I'm looking for ideas on how to approach the problem of connecting dots to form lines. Each line can have an arbitrary number of dots in it, with the dots being no more than a certain distance away ...
1
vote
2answers
240 views

Looking for the name of an algorithm (or technique)

I am searching for an article on the net which I can't find anymore. It was describing an algorithm to rank web pages. I am trying to remember the name of this algorithm or technique. The principle ...
1
vote
2answers
143 views

Efficient datastructure to create size-limited dictionary

I need a class that acts like a dictionary but will constrain the total number of key/value pairs it contains. For instance, let's say the maximum number of entries is 1000 and the class already ...
0
votes
0answers
142 views

C/C++ for algorithm development [closed]

I developed an algorithm and prototyped it in python. Now I need a high performance executable. I've never programmed in C/C++, but know they're the right tools for the job. I'd rather do it in C ...
-4
votes
0answers
36 views

algorithms with graphical output [closed]

I've been looking for this for a while now and guessed I could just as well ask this here see if it gets me anywhere. I like fiddling around with code, I also like making screensavers for personal ...
2
votes
3answers
451 views

shadow simulation from buildings

Is it possible to calculate shadow areas of buildings or simulate shadows of buildings in a city, using the heights of these buildings and the sun angle and azimuth? The basic light tracing concept ...
0
votes
1answer
135 views

I need a data structure for a card game

I am programming a card game in java, and unsure what data structure I should use for the player's hand. I considered using an array, with one integer to traverse the array and another integer to ...
-2
votes
0answers
46 views

Cut the Execution Time Two Times in All-Pair Shortest Path by Using Dijkstra Algorithm [closed]

Complexity of finding single-source shortest path in a simple undirected weighted graph with Dijkstra algorithm (assume that priority queue uses a heap data structure) is: O((n+m)logn) {n - the ...
8
votes
2answers
535 views

How do personal assistants typically generate sentences?

This is sort of a follow up to this question about NLG research directions in the linguistics field. How do personal assistant tools such as Siri, Google Now, or Cortana perform Natural Language ...
5
votes
1answer
160 views

Python rectangle packing

I'm working on a project which involves packing multiple rectangles in a larger rectangle(the bounding box). Rectangles can't overlap with each other or with the boundaries of the bounding box. ...
4
votes
1answer
113 views

Algorithm to find whether there is a path (any path) above length X between two vertices

We all know how to find the shortest path between two vertices, but what if I just want to know the answer to this question - is there a path, (any path), between vertex A and B of length larger than ...
0
votes
0answers
30 views

Trouble with a heightmap adjusting algorithm [migrated]

I have a 2D grid of integers. The user can pick any location and increase or decrease its number by one. The algorithm should adjust all eight adjacent locations so there is no more than a difference ...
1
vote
1answer
108 views

Big O notation of randomness

I was thinking about inefficient algorithms based on randomness and wondered how to categorise them. For instance. Say you wanted to generate all the numbers from 1 to N in a random order but only ...
1
vote
3answers
317 views

Smallest and Largest contiguous repeating sub-sequence in a sequence

I am trying to solve a outdated quiz problem. I am tasked to find the smallest and largest contiguous sequence of repeating numbers in a larger sequence.e.g. ...
-1
votes
0answers
49 views

How to apply Alpha-Beta pruning to a game tree? (Algorithms Theory)

I'm studying for an AI exam, and having trouble working out this question on Alpha Beta pruning. I can answer on the effectiveness of the pruning method and the rules involved in the pruning process, ...
0
votes
2answers
396 views

How are the tiles in WORDAMENT organized?

I'm trying to create a word game, just like WORDAMENT, in my spare time. In order to present a new round, I need to create a board with 16 letters organized in a 4*4 grid. Currently, I'm generating ...
4
votes
3answers
228 views

GPLing an implementation of a patented algorithm

TL;DR: Can you publicly release your own implementation of a patented algorithm as a free research tool for others, under the GPL, when you do not hold the patent (but will happily give clear and ...
0
votes
1answer
82 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 ...
3
votes
1answer
302 views

What is the most efficient / fastest way to keep a list in order?

I implemented Dijkstra's path finding algorithm in JavaScript and a big part of it involves storing the distances to nodes and fetching the smallest. The distances change often and the smallest is ...
0
votes
2answers
318 views

What algorithm should I use for a lot of if else(s)?

I have to implement a lot of if else statements and I'm thinking of using Decision Tree but I'm not sure if it's going to be the right algorithm. I don't want to insert a piece of html code based on ...
0
votes
0answers
99 views

Algorithm to detect if a word is spelled correctly

I am trying to develop a javascript spellchecker that doesn't use a dictionary, and can correctly, given a single word, detect if a word is spelled correctly or not. Right now, I just have a list of ...
5
votes
1answer
1k views

What algorithm should I use to create an automatic staff scheduling feature?

Imagine a small local business (in my case a dog daycare) with a few dozen part-time employees . The goal is to automatically create weekly staff schedules. My question is about what algorithmic ...
0
votes
0answers
130 views

Is this a Bin Packing Problem?

Let us consider we have B Bags and each Bag has some number of Items. The problem is to distribute Bags of Items uniformly across as minimum number of Bins as possible. However, there are two ...
0
votes
1answer
156 views

How to determine whether two trees (not necessarily binary) are isomorphic

Two ordered trees T' and T'' are said to be isomorphic if one of the following holds: ◦ both T' and T'' consist of a single node ◦ both T' and T'' have the same number k of subtrees, and the ith ...
0
votes
1answer
74 views

Sorting Sentences by New Words in Each

A very useful learning tool I stumbled across for Chinese was a massive list of sentences that, barring the first 10 or 15, only differed by the ones before by one or two words, or at least as few as ...
0
votes
2answers
343 views

How can I rank teams based off of head to head wins/losses

I'm trying to write an algorithm (specifically in Ruby) that will rank teams based on their record against each other. If a team A and team B have won the same amount of games against each other, then ...
11
votes
6answers
21k views

How to quickly search through a very large list of strings / records on a database

I have the following problem: I have a database containing more than 2 million records. Each record has a string field X and I want to display a list of records for which field X contains a certain ...
1
vote
1answer
70 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
1answer
93 views

Decision tree (?) reduction

I need to check certain conditions (of size n) on an object and perform one of several options available (size m) based on the result. Seems to me it fits a tree. Now. The tree is quite large and I ...
-1
votes
1answer
66 views

Build odd and even hanoi tower [closed]

I've got problem with hanoi tower. I know how to build normal hanoi tower, it's simple: void solveTowers(char src, char dst, char mid, int n) { if (n == 0) { return; } ...
0
votes
0answers
27 views

Best and simplest way to implement a double ended priority queue with insertion and find operations lg(n)?

What is the best way to implement a double ended priority queue with O(log(n)) complexity of insertion, find min and find max operations? I was thinking to implement a red black tree, but it is a ...
1
vote
2answers
2k views

InterviewStreet (Vertical Sticks) just a tip where to get started [closed]

Having a lot of trouble with this question in interviewstreet.com: Given array of integers Y=y1,...,yn, we have n line segments such that endpoints of segment i are (i, 0) and (i, yi). Imagine that ...
8
votes
1answer
420 views

Does any know of a Algorithm that allows for a figure like this image?

Does anyone know how to create an algorithm capable of making the figure just like in the picture, when given a set of specific points (3D array)
2
votes
11answers
2k views

I don't understand why algorithms are so special [closed]

I'm a student of computer science trying to soak up as much information on the topic as I can during my free time. I keep returning to algorithms time and again in various formats (online course, ...
3
votes
1answer
2k views

booth multiplication algorithm

Is booth algorithm for multiplication only for multiplying 2 negative numbers (-3 * -4) or one positive and one negative number (-3 * 4) ? Whenever i multiply 2 positive numbers using booth algorithm ...
1
vote
2answers
76 views

Efficient range search for pair of numbers

Assume we have large list of pairs: struct {x: double, y: double} pair; vector<pair> What is the most effective way to find all pairs where (x1 < x < x2) AND (y1 < y < y2)? O(n) ...
5
votes
2answers
204 views

Algorithms for allocating N balls into M boxes

Every box has at least no balls and at most N balls. Of course the total number of balls in M boxes must equal to N. For each allocation, I calculated a value based on the allocation: ...
0
votes
1answer
159 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. ...