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)

3
votes
2answers
144 views

Search for the (slowly moving) number with penalty for too high test value

You task is to design a search algorithm that will find my secret number, which is between 0 and 2^64. If your test value is too low you can test again in 1 second. If your test value is too high you ...
0
votes
1answer
60 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 ...
2
votes
1answer
187 views

Is there a purely SQL alternate to looping?

Historically, I probably would have written a script (php or something) to loop through all spreadsheet rows and perform some calculations. I'm looking for a pure SQL solution on the presumption ...
0
votes
0answers
30 views

Algorithm for inserting into sorted subset

A is a sorted list. B is a sorted list, and a subset of A. If an element is inserted into A at index i what's the most efficient way to determine the correct index i' for it's position in B? Given ...
2
votes
0answers
96 views

Why isn't there parallel reduction in the Standard Template Library?

Alexander Stepanov stated in talks and interviews that his realization that eventually lead him to generic programming and the Standard Template Library, was from the case of the parallel reduction ...
0
votes
0answers
46 views

Algorithm to Select Sequential Subarrays from an Array

I solved my problem by using simple nested loops and comparisons but I'm wondering if there is a well known Selection Algorithm to solve my problem. Let's say I have an array such as [1, 10, 250, 9, ...
0
votes
0answers
80 views

Algorithm / working approach to get a random list of data

I am working on a android schedule app but that isn't matter , the problem is a algorithm / methodology so you are welcome to just write the pusedo code to answer. The data is like this Place ...
1
vote
2answers
144 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. ...
3
votes
1answer
75 views

Comparing absolute values when determining zero crossing in 2D image

I am trying to implement an algorithm for finding the zero crossing (check that the signs of all the entries around the entry of interest are not the same) in a two dimensional matrix, as part of ...
0
votes
0answers
36 views

Maximize the visibility of an ad to a maximum of people in an automatic advertising system

I have N different ads that I want to display at the same time to M people in an automatic advertising system. Some people will never see some ads because they only check some specific criteria on the ...
2
votes
3answers
220 views

How to implement a Weighted shuffle

I recently wrote some code that I thought very inefficient, but since it included only a few values, I accepted it. However, I'm still interested at a better algorithm for the following: A list of ...
0
votes
1answer
130 views

Euclidean Space Fully Connected Nondirectional Graph: Shortest Path to all nodes

So this may be a question that is born of my inability to properly express my intentions to Google. In a fully connected non-directional graph such that any three points can be properly represented ...
-1
votes
1answer
88 views

Optimal movie schedule

Let's say Mr. A goes to cinema and he gets a movie schedule. There are N movies on the program today (1 < N < 50) and for every movie the time of the start and the time of the end are given in ...
1
vote
2answers
176 views

Given two sorted array in ascending order with same length N, calculate the Kth min a[i]+b[j]. Time complexity O(N)

Given two sorted array in ascending order with same length N, calculate the Kth min a[i]+b[j]. Time complexity O(N). Another variant of the question goes like this: given a matrix with sorted rows, ...
0
votes
3answers
306 views

Print bottom view of a binary tree

For a binary tree we define horizontal distance as follows: Horizontal distance(hd) of root = 0 If you go left then hd = hd(of its parent)-1, and if you go right then hd = hd(of its ...
3
votes
2answers
251 views

How to find number of points with same minimal distances on matrix

I'm trying to find the number of points in a matrix with the same minimal distances. Start with a MxN matrix, where M and N < 50000. There is given a set of fixed points, with their respective ...
0
votes
2answers
163 views

Solution Checker Algorithm for a Game

For the moment I'm strictly speaking in Pseudocode. I'd only like to see if i'm on the right track. The game I'm talking about is similar to a application called FLOW. In this game, you're given a ...
0
votes
1answer
336 views

Beginning Data Mining

For simplicity, my database has entities and transactions. Each transaction has a DateCreated and a foreign key to the entity. I'd like to have the ability to find entities that have had a recurring ...
0
votes
1answer
66 views

How can a route finding program avoid obstacles/locations when calculating routes? [closed]

Do you delete nodes from the underlying graph representation? Or is there a more elegant way to do it?
0
votes
0answers
21 views

Calculating combinations from categories

I'm trying to calculate every possible selection from different categories. 1 choice must be made from every category and the categories are always in the same order. I save a string where each ...
-1
votes
1answer
177 views

How to create a some kind of value for sentences? [closed]

I want to identify most matching sentence using some pattern. That means by using java algorithm I want to create identical value for each sentences.Each sentence when entering to that algorithm can ...
0
votes
0answers
29 views

Readers Writers algorithm help - starvation and no starvation

I found this link, as an explanation of r/w problem - http://pages.cs.wisc.edu/~bart/537/lecturenotes/s7.html But, I'm having problems realizing is there any starvation present here and why? Also, if ...
-1
votes
1answer
73 views

Difficulty implementing algorithms from abstract understanding [closed]

I've got decent programming experience for an undergraduate. I just started the study of algorithms. I read the description and saw visual examples that make perfect sense in my head. But when it ...
1
vote
0answers
113 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: ...
2
votes
2answers
91 views

Set distances algorithm question

I have multiple sets containing integers. An integer maybe present in one set or multiple sets. I would like to find/match the sets with the most common integers. Example s1 {1, 2, 3, 4} s2 {1, 3, 4, ...
1
vote
2answers
198 views

What is a O(n) algorithm to solve this puzzle?

We are going to hold a meeting where everybody will speak in clockwise direction around a table. There are n people with n spots. Each person has a position preference (e.g. some want to go first, ...
0
votes
1answer
42 views

How do I mutate a value in a genetic algorithm using Gaussian distribution?

I've been reading 'Introduction to Evolutionary Algorithms'. This method is stated, but not described, and I can't find anything more specific online. p44/45 of 2nd Ed for reference. "adding to the ...
6
votes
1answer
148 views

Heuristic Approach for Flexible DIFF Implementation

I have created a DIFF implementation to compare document revisions at work. It is based on An O(ND) Difference Algorithm and Its Variations. One thing that has become important is to take the list ...
0
votes
1answer
169 views

How to develop an algorithm for brute-forcing / backtracking?

As a beginner programmer, I don't know how to conceptually think about brute-forcing. My mind can't really fathom how to write code that will try every possibility. I have a problem that I want to ...
1
vote
1answer
133 views

LLVM case: is the success due to the algorithms? [closed]

I'm not sure if this is a subjective question, I hope not but I'm not proficient with LLVM so I'm just wondering: how come it's become so popular and so widespread used in the industry? Were the ...
1
vote
1answer
63 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
200 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
222 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 ...
0
votes
0answers
38 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
178 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
49 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
123 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
63 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 ...
2
votes
1answer
125 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
70 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
100 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
706 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
34 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
104 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
108 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
165 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
47 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
171 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
118 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 ...