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

Which algorithm to find the shortest (nodes count) path that encompasses all polygons inside a larger polygon?

Inside a large polygon (say the USA boundaries) I need to find the shortest path that will encompass smaller polygons (say the following cities: Kansas city, St Louis, Memphis, Oklahoma City) By ...
1
vote
1answer
106 views

Sorting a large number of unknown items with multiple stacks

Here is a problem I'm trying to solve for a personal project. I'm not exactly sure how best to even approach it. Problem: I have a single stack already populated with several thousands of unknown ...
0
votes
0answers
47 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, ...
4
votes
1answer
75 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 ...
-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. ...
3
votes
3answers
2k views

Try to find a word in the dictionary that has most letters given

I recently came across an algorithm design problem that I'd like some help with: Given some letters, for example a,e,o,g,z,k,l,j,w,n and a dictionary of words. Find a word in the dictionary that ...
1
vote
0answers
81 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 ...
-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 ...
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
34 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?
2
votes
2answers
145 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 ...
1
vote
1answer
85 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
70 views

Split multiple overlapping intervals to non overlapping intervals

currently I try to build an algorithm to split an array of overlapping intervals to a new array with non overlapping intervals. For example: Array of overlapping intervals: [ {0,7}, {8,12}, ...
1
vote
1answer
113 views

Non-fixed-size Fenwick Tree implementation

I'm planning to implement a non-fixed-size Fenwick tree. That is, a Fenwick tree that allows interleaving range queries with adding/removing elements. All implementations and samples I've seen so far ...
4
votes
1answer
167 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 ...
12
votes
2answers
3k views

What is the relationship between data structures and algorithms? [closed]

I have been searching for a good online course in data structures but have found that Google also returns results for algorithms courses, which say stuff like: In this course you will learn ...
16
votes
2answers
10k views

How would you implement Google Search? [on hold]

Supposed you were asked in an interview "How would you implement Google Search?" How would you answer such a question? There might be resources out there that explain how some pieces in Google are ...
3
votes
1answer
276 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 ...
3
votes
2answers
48 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 ...
4
votes
2answers
124 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 ...
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 ...
0
votes
1answer
84 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
2answers
96 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 ...
0
votes
3answers
90 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 ...
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 ...
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 ...
52
votes
16answers
5k views

Is big-O really that relevant when working in industry?

In every interview I have been in, I have been quizzed on mathematical analysis of complexity, including big-O notation. How relevant is big-O analysis to development in industry? How often do you ...
-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, ...
4
votes
1answer
124 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 ...
1
vote
1answer
382 views

find second smallest element in Fibonacci Heap

I need to describe an algorithm that finds the second smallest element in a Fibonacci-Heap using the Operations: Insert, ExtractMin, DecreaseKey and GetMin. The last one is an algorithm previously ...
4
votes
5answers
3k views

Retrieving maximum value from a range in unsorted array

I have an unsorted array. I have queries in which I give a range and then the maximum value from that range has to returned. For example: array[]={23,17,9,45,78,2,4,6,90,1}; query(both inclusive): 2 ...
-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 ...
2
votes
4answers
2k views

Best resources to really understand run-time complexity [closed]

I'm familiar with the basics of run-time analysis such as what makes certain types of code O(n) and O(n^2). But I'm having real trouble learning, understanding, and really remembering how to analyze ...
5
votes
2answers
291 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
4answers
615 views

FizzBuzz on Large Scale

So I was asked to create FizzBuzz at an interview... easy enough. for(int i = 1; i <100; ++i){ if((i%3) == 0) cout<<"fizz"; if((i%5) ==0) cout<<"buzz"; ... ...
5
votes
1answer
444 views

Firefighting allocation problem

I'm trying to develop a model to work on an assignment problem in the firegifhter area. Given n firefighters, m trucks and z ongoing fires, each with a danger level, try and allocate the resources in ...
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 ...
7
votes
2answers
2k views

Does LINQ require significantly more processing cycles and memory than lower-level data iteration techniques?

Background I am recently in the process of enduring grueling tech interviews for positions that use the .NET stack, some of which include silly questions like this one, and some questions that are ...
9
votes
1answer
1k views

Hash function classification

On the internet, I've come across this question: Classify the Hashing Functions based on the various methods by which the key value is found. with answers like Direct method Subtraction method ...
-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?
-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 ...
0
votes
1answer
77 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 ...
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 ...
1
vote
1answer
24 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 ...
2
votes
4answers
2k views

How do you find the first common element in two arrays

How do you find the first common element in two arrays? My attempt: I looped through each at the same time and add the current value to a separate set for each of the lists. Also, check if the ...
10
votes
5answers
837 views

Interview puzzle on traveling on a line segment

On a number line of length M, where 0 < M <= 1,000,000,000, you given N (1 < N <= 100,000) integer pairs of points. In each pair, the first point represents where an object is currently ...
2
votes
5answers
565 views

Find pattern in a string

How would one approach the following question: We have two strings: a normal alphanumeric string and a pattern string. the pattern string can be composed by alphanumeric chars plus the char "?" ...
0
votes
1answer
477 views

Count Sort Algorithm efficiency

As I read a book about "Algorithm Analysis", I came across count_sort Algorithm. However, I have read elsewhere that "Quick Sort/ Merge Sort" are the best and the most efficient sorting algorithms. I ...