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)

-1
votes
0answers
28 views

Square spaced spiral matrix

During an interview I've been asked to write an algorithm that create a square spiral like this one : *********** * ********* * * * * * ***** * * * * * * * * * * * * * * * *** * * * ...
3
votes
1answer
58 views

Improve bisection method or alternate algorithm for efficient determination of text font size to fit in a box

I need to find the font size of a text that fits in a box. Given my current font size, I can get the bounding rectangle of the text. If I set some arbitrary min and max font size, I suppose I can ...
1
vote
0answers
79 views

Software Design, Generic Programming, Physical Devices, and Algorithms in C++ [on hold]

I often have data that in some contexts I want to handle uniformly, but in other contexts I wish to differentiate it. For example, I could have a vector that is series of angles or a series of ...
0
votes
0answers
35 views

Approaches to combinatorial optimization problem

Problem I have the following combinatorial optimization problem: A set of applications need to be distributed among a set of nodes. Each node has a capacity and each application has a required ...
-3
votes
0answers
33 views

Fastest way to gather Provider data [on hold]

What's the most efficient and quickest way of mining medical providers data in order to list them under a website and categorize them by city and state? Is it through an algorithm?
-6
votes
1answer
26 views

Best and simplest algorithm to match a set of products into a category? [on hold]

I have a database with millions of products and a few hundreds of categories. I'm trying to find a way to match a given product to category. My current algorithm is insufficient and puts many products ...
-5
votes
0answers
38 views

Which algorithm will be efficient,if I have Database with all possible recipes of any 1 category? [on hold]

I want to make a android app on getting recipes by ingredients. Which algorithms can be used in following scenario ->if i have a database table with fields Dish_Name,Ingredients,Method/Procedure. ...
1
vote
1answer
82 views

Evaluation function for games

I have been trying to write a bot for quarto game. As usual I tried to solve it with Min-Max and alpha-beta pruning. But I am stuck at finding a proper method to evaluate non-final states. As you can ...
0
votes
1answer
33 views

Simple Path to Route Algorithm

I'm currently conducting research into subway paths, but stand in front of a problem, with no programming knowledge and an extremely short time-limit. Probably the question I am asking is trivial, ...
2
votes
2answers
144 views

Algorithm and data structure to match groups of users (1-5 each) into 2 balanced sets of 5 users

I'm building a matchmaking queueing service for a 5v5 team-based game. I have a large set of users that are grouped into unique lobbies comprised of 1-5 users each. Each user has an integer based ...
4
votes
1answer
165 views

Minimizing compression overhead in a simple compression algorithm

Note: this question has been re-written to simplify and generalize the problem. The original is available below. Suppose I created a simple compression scheme for lists of 2-digit numbers. It has 2 ...
3
votes
2answers
47 views

(Partially) Sorting a lazy-evaluated collection

So I'm trying to implement a lazy-evaluating data type (in PHP, though that shouldn't matter any) where you can queue up actions to take on a set of data. This data can come (theoretically) from any ...
0
votes
1answer
83 views

Is external merge sort a divide-and-conquer algorithm? [on hold]

Today I was corrected for mentioning "External Merge Sort" as an example of a divide-and-conquer (D&C) algorithm and after doing a lot of research online and in the most prominent books on ...
-2
votes
0answers
33 views

What is the right algorithm to detect segmentations of a line chart? [closed]

To be concrete, given 2D numerical data as is shown as line plots below. There are peaks on a background average movement (with small vibrations). We want to find the values of pairs (x1, x2) if those ...
1
vote
0answers
59 views

Efficient extensions of degree of separation

I'm trying to play around with the 6 degrees of separation problem, specifically the Kevin Bacon game to find alternative ways of playing the game. I want to eventually port it over to MapReduce, but ...
9
votes
5answers
2k views

Simple and clean way of comparing three numbers

I've got some code that has a sequence of ifs that work, but just feel messy. Basically, I want to choose the largest of three integers and set a status flag to say which was chosen. My current code ...
-1
votes
0answers
39 views

Having trouble understanding/implementing backpropagation algorithm in neural network [closed]

I have a simple feedforward neural network with 2 input neurons (and 1 bias neuron), 4 hidden neurons (and 1 bias neuron), and one output neuron. The feedforward mechanism seems to be working fine, ...
6
votes
5answers
348 views

Drawing concentric circles without gaps

I want to fill a circle with alternate colors like a lollipop by drawing circumferences of increasing radius on a Cell matrix. I am currently using the Midpoint circle algorithm to get the points. The ...
4
votes
2answers
123 views

Algorithm to find the optimal trade route (negative cycle with lowest cost per edge in a digraph)

Given the following problem (a slightly simplified description of trading in the computer game Escape Velocity: Nova (system map)): Given a set of (solar) systems. Each system is connected by ...
1
vote
2answers
91 views

Find the maximum number of pairs of numbers that are in a range, between two arrays

Lets say I have two arrays A and B A = {1,2,3} B = {12,11,67} and have max sum value S = 10 How many maximum number of unique pairs can be formed between the two arrays who's sum is less than or ...
-1
votes
1answer
53 views

Introduction on Data structure [on hold]

I just completed my c and try to solve some problem on hackerrank. I just want to ask what should i read next? Should i read data structure and algorithms, i know that algorithms are important like ...
0
votes
0answers
17 views

How would I determine statistical significance for ad impressions? [migrated]

I'm programatically adding keywords to bid on. Some keywords will trigger ads and impressions, and some impressions will trigger clicks. Clicks / impressions = CTR (click-through-rate). There will be ...
-2
votes
0answers
17 views

Finding the bounding boxes of intersections of a set of rectangles

Say you're given a set of rectangles in the form (x, y, w, h), some of these are overlapping and some are not. I'm looking for a (fast!) algorithm that will produce another set of rectangles, which ...
-3
votes
1answer
50 views

Getting back the string from md5 hash running all possible combination? [on hold]

Is it possible to get back the string using Super Computer? What if we write a program which can convert the string to md5 Hash and compare with the given md5 hash?
5
votes
2answers
288 views

What does pi mean in this BFS algorithm pseudocode?

I have the following pseudocode for breadth-first search algorithm BFS(G,s) 1 for each vertex u ∈ V(G) \ {s} 2 color[u] = white 3 d[u] = ∞ 4 π[u] = nil 5 color[s] = gray 6 d[s] = 0 ...
2
votes
0answers
73 views

Choose a number of arrays which have the smallest cardinal number when unified

Say we have multiple arrays: var a := [1, 2, 3] var b := [2, 3, 4, 5] var c := [1, 3, 4, 6] var d := [1, 2, 5] We want to find the three arrays with the smallest cardinal number when the three ...
6
votes
1answer
157 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
97 views

Shape-Checking algorithm

I normally have a very intuitive approach to an efficient algorithm. In essence, I know what the bottleneck is, and how I can improve the algorithm. However, I'm now stuck and I am in the need of some ...
2
votes
3answers
59 views

Find all circles that cover one point

I'm not sure if I've been searching using the wrong keywords, but I've tried so many different ways of wording this and I can't find a relevant answer. Basically, given a set of circles defined by ...
6
votes
0answers
251 views

Algorithm/data structure to answer “what recipes can I make with this set of ingredients?”

Formally, let s(U, Q) = {V | V ∈ U and V ⊆ Q} where U, Q, and V all represent sets, and U, more specifically, represents a set of sets. For the sake of example, U might be a set of the (sets of) ...
1
vote
1answer
57 views

Need semi-efficient algorithm for 3-dimensional increasing sequence

I have a set of puzzle challenges for a prototype jigsaw puzzle kit, similar to commercial products offered by Thinkfun and Popular Playthings. I have a candidate list of 300 puzzle challenges and ...
3
votes
1answer
79 views

Algorithm to compute k-permutation without repeating and no duplicates

I have a set of integers, for example 1..20 and I want to get all possible combinations of that set drawing 5 numbers. So each combination has 5 numbers from that set of integers. But I don't want ...
-1
votes
2answers
74 views

Algorithm involving a stack for this problem [closed]

I'm having exams later this week and I literally don't have any clue on how to solve this question: You're given a row R1 of the following shape a1, a1, ..., R2, a1, ..., a1 R2 is a row of the same ...
1
vote
2answers
62 views

Given an array of n bits, how to generate every permutation with i 1's and n-i 0's?

It's simple enough to brute force a collection of strings and then filter for every occurrence with the required count of 1's. As n increases the number of possible permutations becomes very large, ...
2
votes
1answer
42 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
107 views

Find a line that is closest to scattered points

I came across the below interview question on Glassdoor: A scatter graph of points on a page, draw a horizontal line across the page such the the perpendicular y distance to the line from all ...
1
vote
0answers
76 views

Reversing dithering algorithms?

I was trying to make an implementation of the Floyd-Steinberg dithering algorithm in Python, and I was wondering, since Bitmaps files store their data starting from the bottom-left corner, would it be ...
18
votes
5answers
4k views

Advantage in being the first to copyleft a new algorithm? [closed]

Say I have created a new (DSP) algorithm. Will I have some advantage if I open source the algorithm under copyleft licence (GPL etc.)? From what I know about licensing this should lock people out from ...
-1
votes
0answers
28 views

Can I use a 3-dimensional simplex noise implementation to generate noise over a spherical surface?

Say, I want to generate noise over a sphere. I want to do this to procedurally generate three-dimensional 'blobs'. And use these blobs to generate low poly trees, somewhat like this: Can I ...
2
votes
0answers
25 views

Project a piece of image cut by N-vertex shape to a different N-vertex shape

I have an N-vertex shape that I cut out from an image, and I want to project it onto another shape with the same amount of vertices, but different. So, the image will get changed inside the ...
0
votes
4answers
110 views

Pick highest score sum, but at least X from each region

Can you think of a solution to the following seemingly simple algorithmic problem? I am given a list of data points with scores and regions they belong to: [(9, A), (8, B), (7, A), (3, C), ...]. ...
0
votes
0answers
47 views

Matrix column dimension containing '>' in C [migrated]

I found a small C function that given a matrix, it removes the line 0 and the column 'i' and then put it in another matrix, everything in order to calculate the determinant of the simplified matrix , ...
0
votes
1answer
76 views

Algorithm to find groups of common relations

I have a very large dataset with two columns of interest: Name and Cousin. Each row has a unique name and each name has a cousin. The data is mutually inclusive, so the cousin's name will also ...
6
votes
2answers
132 views

Algorithm for comparing hundreds of similar, but not identical documents

I have seen similar questions about text comparison, but none on such a large scale. I have a client with two sets of recordings of speeches, 250 and 550 recordings each. Each of the recordings in ...
1
vote
1answer
23 views

Advantage of non-deterministic staistical analysis?

I am working with a Java Library used for identifying the language of a given text. It relies on an n-gram analysis of the text to return a set of languages it might be and the "confidence" that it ...
0
votes
1answer
62 views

How can I map a number of points of a polygon to matching points of a larger rectangle?

Suppose I have 2D polygon image and a larger 2D rectangle image and that I have a collection of points for each that I want to align. For Example the polygon has point collection: [PA(a, b), PB(c, ...
0
votes
3answers
158 views

Best algorithm to determine whether two arrays can be the same in a circular queue

I'm trying to figure out an efficient way to determine whether two distinct arrays of the same size can be shifted to form the same circular queue. For example: Array1 = ['A','B','C','D'] Array2 = ...
0
votes
1answer
57 views

hashing algorithm to check inclusion in a set

The problem I am trying to solve is to validate if a username is already used before allowing an admin user to create a new user with that username. Currently I am doing an ajax request to check if ...
0
votes
0answers
34 views

Algorithms for Academic Auditing?

I am trying to come up with an algorithm to perform academic auditing for college students. I never took an Algorithm course, any help is appreciated. Input: Degree requirements, Additional program ...
2
votes
0answers
25 views

Optimizing trigram look ups with wildcards

I am working on creating a spell-checking service for Android (note: this is a platform- and language-neutral question) for Asturian, a minority Romance language. We're using hunspell as the base but ...