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)

2
votes
3answers
112 views

Count unique visitors by group of visited places

I'm facing the problem of counting the unique visitors of groups of places. Here is the situation: I have visitors that can visit places. For example, that can be internet users visiting web pages, ...
0
votes
1answer
61 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 ...
1
vote
1answer
93 views

City exploration algorithm

The purpose of the algorithm is to create n routes on a geographical map, where n is being given, whereas all routes take no longer than t time units by foot and end where they start, while trying to ...
0
votes
0answers
40 views

Floating point number to binary

Which Algorithm does java uses to convert floating point number (Ex:0.15625) into binary(0.00101). Whether java uses normalized form or denormalized format ? If i type "float ab=0.15625" in java ...
2
votes
3answers
126 views

Find all possible subarrays of an Array

I am lost I just can't seem to get my head around backtracking/recursion approaches. I understand how simple recursion problems like factorials work I can even trace those by hand. But when it comes ...
2
votes
1answer
46 views

Need help identifying a league scheduling algorithm

I am trying to create a sports league scheduler. I am having trouble identifying an algorithm to help me efficiently fill in each slot. Sample data to build the schedule would be: 10 teams Each ...
569
votes
9answers
172k views

Which hashing algorithm is best for uniqueness and speed?

Which hashing algorithm is best for uniqueness and speed? Example (good) uses include hash dictionaries. I know there are things like SHA-256 and such, but these algorithms are designed to be ...
-3
votes
0answers
35 views

Dynamic programming algorithm for finding minimum spanning tree

I know cool greedy algorithm like brokuva, kruskal and prim's exists for finding minimum spanning tree but I am curious to know a dynamic programming algorithm for finding minimum spanning tree.I am ...
-4
votes
1answer
81 views

Does the head of any linked list must contain any data [closed]

Is there any rule that says the head of any linked list should contain data. Is it because by doing it so we save a space for one node. Why for some implementation of head contains data and for other ...
-1
votes
1answer
86 views

Unevenly distributed random number generation [duplicate]

Let's say I have to generate random number from 1 to 100, however, the probability of each number is not 1/100, but a predefined probability. How to generate that number? I use Ruby/Python.
0
votes
1answer
75 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 ...
1
vote
4answers
115 views

Efficient “Object with weights” structure

I need to find an "efficient" data structure / set of algorithms to do the following things: I have a list of objects. I need to assign them weights and later on increase or decrease these weights. ...
4
votes
2answers
148 views

algorithmic problem - Combining overlapping ranges

I'm looking for an idea to efficiently solve following problem: I have a set of pairs of ranges (range = a pair of numbers), each range is unique (but has same size) e.g. [ [(0,6),(34,40)], ...
1
vote
2answers
126 views

Best practices for geolocation

We are writing a flight search engine. We want to pre-fill the departure airport for mobile users with the closest one to their location. To do that, our plan is to Find a list of airports with ...
2
votes
1answer
186 views

Implementation of chess endgame engine without Endgame Tablebases

I'm interested in creating an chess endgame solving engine. The endgames in chess are usually solved using the endgame table-bases generated by retrograde algorithm. I have found that Artificial ...
0
votes
0answers
58 views

Estimating the time it takes for this quick find algorithm to complete [closed]

I am trying to run an estimate on how long this quick find algorithm takes on Union Find type problems. Here is the code: public int find(int p) { return id[p]; } public void union(int p, int q) ...
-1
votes
0answers
37 views

Help finding the tilde of the following algorithm [closed]

Suppose I have an algorithm that takes N^100/2^N to complete. Would the tilde of this be 0? But then that does not make sense. However, since the alogrithm tends to 0 as N increases, what should the ...
4
votes
2answers
91 views

To find the oldest/newest element in a heap

I want to find the oldest/newest element added into a heap of size k. At any given point of time if I have to find say the oldest element in the heap is there any approach with O(1) space and O(1) ...
47
votes
7answers
4k views

How important is it for a programmer to know how to implement a QuickSort/MergeSort algorithm from memory? [closed]

I was reviewing my notes and stumbled across the implementation of different sorting algorithms. As I attempted to make sense of the implementation of QuickSort and MergeSort, it occurred to me that ...
0
votes
1answer
70 views

How can I approach creating an efficient algorithm for maximizing value with these specific constraints?

I'm having trouble coming up with an approach that isn't n^2 for this problem. Here's a contrived, simplified version I've come up with: Let's say you're a company that needs 4 employees to launch in ...
1
vote
4answers
115 views

Is there a clever way to calculate a mode of an online series without storing the series?

My program's aim is to determine the correct time zone offset (GMT+k) as a series of numbers are fed to it. eg: -4 +11 1 -4 -4 So, here -4 (the mode of the series) is the correct value. But this ...
0
votes
3answers
192 views

What does this function do?

Does this function means its calculating x=(x-1) + x^2? Function unknown(x) if ( x == 1 ) return 1 else return unknown(x‐1) + x*x
0
votes
1answer
102 views

Calculate reachability of one point from another

I have an array which stores a set of positive x coordinates in sorted way, say arr={1, 4, 5, 9, 12, 45} etc. And I have a maximum distance k which I can go from one point to another point let ...
26
votes
5answers
3k views

Divide and Conquer algorithms – Why not split in more parts than two?

In divide and conquer algorithms such as quicksort and mergesort, the input is usually (at least in introductory texts) split in two, and the two smaller data sets are then dealt with recursively. It ...
0
votes
0answers
64 views

What Algorithm can be use for task allocation based on location?

What algorithm can be use for task scheduling based on location? For example there are 100 students and 5 lecturers available. Each lecturer must get same amount of student using location allocation ...
0
votes
1answer
222 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 ...
3
votes
2answers
375 views

NLP - Queries using semantic wildcards in full text searching, maybe with Lucene?

Let's say I have a big corpus (for example in english or an arbitrary language), and I want to perform some semantic search on it. For example I have the query: "Be careful: [art] armada of [sg] is ...
6
votes
3answers
211 views

Algorithms for making image mosaics - is there a quicker way than this?

I've been playing with making image mosaics. My script takes a large number of images, scales them down to thumbnail size and then uses them as tiles to approximate a target image. The approach is ...
0
votes
1answer
70 views

An algorithm for finding converse duplicates of ordered pairs

Given an array of ordered pairs of values, is there a well-known algorithm to find converse duplicates? [Converse meaning the same values, but in the opposite order.] That is, given ...
0
votes
1answer
89 views

Permutation tests for large sequences

I would like to perform a permutation test on a particularly large data set, i.e. around 4 million entries. Basically, I need to get some number of random permutations of this data set. Usual way to ...
0
votes
1answer
60 views

Count Sort Algorithm efficiency

As I am reading a Book about "Algorithm Analysis", I came across count_sort Algorithm. A question has been raised in my head. I read in many other papers, that "Quick Sort/ Merge Sort" are the best ...
2
votes
1answer
77 views

How deep is enough to represent an algorithm in UML sequence diagram?

I have three simple classes. LoginController, UsersCatalog and User. UsersCatalog has an array of User. I have to represent a simple process of login. LoginController has a method login(username, ...
0
votes
1answer
34 views

Tweaking a ranking algorithm from a few variables

I'm going to have a mySQL table with elements in it and would like to rank them in the same manner than Reddit but not quite. I'd like to know how to add or remove importance to a variable in my ...
2
votes
1answer
36 views

I have an unordered list of rectangles and their neighbors on four sides with no origin. How can I efficiently convert this into a grid?

I am writing a GtkGrid-like container for my GUI library for Go, and I'm trying to write the actual layout part of the code. Basically, I have an unordered list of controls. Each control is a ...
1
vote
1answer
80 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 ...
4
votes
2answers
274 views

Which algorithms do I need to look into?

First things first: I need to apologize in advance about the bad choice of title for this question, but I really couldn't come up with something meaningful. I'm actually looking for suggestions as to ...
0
votes
1answer
43 views

Calculate which quantity packages to use based on quantity of bookings

In my app, many appointments can be booked for activities. Each activity has many price packages with a price and a quantity. On showing the cart, I need to work out what combination of packages ...
1
vote
1answer
81 views

Algorithm to match timestamped events from two sources

I have two different physical devices (one is camera, one is other device) that observe the same scene and mark when a specified event occures. (record timestamp) So they each produce a serie of ...
1
vote
2answers
158 views

How to measure algorithm accuracy?

I have a few optimization algorithms (for finding function minimum) and I'd like to check how good they are. Suppose I build test cases and compare the actual results to theoretical ones. What ...
0
votes
1answer
64 views

Sequentially/parallel algorithm for extracting blob outer perimeter/contour length

I have labelled the connected components in a binary image and found their areas and bounding boxes. The components are not necessarily filled, and may contain holes. I wish to identify the component ...
8
votes
2answers
1k views

How is the “Pizza picking problem‍​” solved using dynamic programming techniques?

Winkler's pizza picking problem: A circular pizza pie of n slices, where slice i has area S_i i.e, the area is different for each pie piece. Eaters Alice and Bob take turns picking slices, but it ...
0
votes
0answers
7 views

In Perl, best way to insert a char every N chars [migrated]

I would like to find the best way in Perl to insert a char every N chars in a string. Suppose I have the following : my $str = 'ABCDEFGH'; I would like to insert a space every two chars, so that I ...
-1
votes
1answer
102 views

How to implement a genetic algorithm with distance, time, and cost [closed]

I want to make a solution to find the optimum route of school visit. For example, I want to visit 5 schools (A, B, C, D, E) in my city. Given the choice of five routes regarding what school I should ...
0
votes
1answer
114 views

How does stock brokers implement limit / trailing stop loss sell logic? [closed]

Let's take Fidelity for example, one can set to sell a stock with a trailing stop lost of 2% of last price, or even more simpler, one can set a limited sell order at any given price. And it must have ...
0
votes
3answers
91 views

How to convert this recursive problem to iterative? Line Simplification algorithm fails to run due to Maximum Recursion Depth being hit

I am implementing the Douglas, Peucker's Line Simplification algorithm in Python. I started with this implementation. However, it fails to run in Python due to Maximum Recursion Depth being hit. How ...
7
votes
6answers
533 views

Algorithm to generate N random numbers between A and B which sum up to X

This problem seemed like something which should be solvable with but a few lines of code. Unfortunately, once I actually started to write the thing, I've realized it's not as simple as it sounds. ...
1
vote
2answers
42 views

Algorithm to match items be value into sets base on total

Given n sets of items. Each item has a value. The items in a set have similar values but vary by a small amount. The goal is to create new sets containing three items selected from the original sets ...
1
vote
2answers
164 views

How to know whether to create a general system or to hack a solution

I'm new to coding , learning it since last year actually. One of my worst habits is the following: Often I'm trying to create a solution that is too big , too complex and doesn't achieve what needs ...
0
votes
1answer
83 views

Finding “spare time” in a day from within a list of events

I have a list of events which is always sorted chronologically. The start time is always followed by the end time. Times are strings formatted as 'HHmmss'. // list of events var events = [ ...
3
votes
2answers
148 views

Ranking players depending on decision making during a game

How would I go about a ranking system for players that play a game? Basically, looking at video games, players throughout the game make critical decisions that ultimately impact the end game result. ...