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
2answers
71 views

Algorithm for implementing QOS in my proxy

Here's the situation: I'm making a proxy (for the moment running on my laptop) which deals with HTTP(S) requests from incoming clients (for the moment only one client, i.e. my Chrome browser on my ...
3
votes
2answers
152 views

How to match up courses with requirements

I have a list of courses taken by a student, as well as several requirements. Each requirement consists of a list of courses that fulfill that requirement and the number of such courses that must be ...
5
votes
1answer
57 views

Data structure for determining intersection between line and polygon in 3D

I have a collection of non-self-overlapping simple polygons P. In actuality, they are 2D triangles in 3D-space. I'm looking for a data structure which, given a line L, has a relatively fast lookup ...
2
votes
1answer
55 views

Matrix multiplication range queries

I have a huge list of matrix i.e A = {M0, M1, M2 .. Mn}. I have a task to find the product of all the matrices in a given range {x,y} i.e Mx * Mx+1 * Mx+2 ... * My. I would like to know if there is ...
1
vote
0answers
23 views

Create unique buckets for stream of entities based on constraints on the entity attributes

I have stream (magnitude 10s of millions) of entities, say Item which is modeled as below: class Item { String id; Double price; Double profitPercentage; Country originCountry; Country ...
-2
votes
1answer
151 views

How to find complexity of T(n) = 8T(n/2)+n^2.93(log n)^93?

I believe we have to use a variant of master theorem...can someone suggest me how to find complexity of such equation which doesn't directly fit into Masters theorem.
1
vote
1answer
39 views

Implementing CMA-ES

I am attempting to implement the CMA-ES optimization algorithm in my favorite language (using the example code here as a guideline), but I need help solving a problem I am having. To test the ...
3
votes
0answers
143 views

How to distribute a number of elements in a bucket so that it is within a range?

I have 50 elements n1, n2, n3, ... , n50 and a limited number of buckets, say 5 buckets and each bucket can hold a range from, say 100 to 150 only (which is nothing but the sum of the elements in that ...
17
votes
5answers
6k views

Is this a Proper “Rule” for Identifying the “Big O” Notation of an Algorithm?

I've been learning more about Big O Notation and how to calculate it based on how an algorithm is written. I came across an interesting set of "rules" for calculating an algorithms Big O notation and ...
1
vote
1answer
147 views

Complexity of recursive calls

my brain is a little stuck as I am trying to compile an example for my blog. I am presenting an algorithm that draws a number from an array, adds it to a sum and calls itself recursively. func ...
0
votes
2answers
139 views

Check if list has a list of values

I have been trying to figure out an efficient algorithm that can check if a list of values contains a list of values. Both lists are sorted in ascending order. For example: Check if var ...
2
votes
1answer
202 views

Word game algorithm

Back in the days of 8-bit machines there existed an educational word game. I have no idea what it was actually called but for the sake of this question (since it involves pyramids) let's call it ...
-2
votes
0answers
22 views

How to find the algorithmic complexity of this program? [duplicate]

I have the following program which finds out all the prime factors of a given number. Algorithm: Divide by 2 until the number is odd, for each successful division add 2 to list of prime factors. ...
-2
votes
1answer
68 views

Find largest subset where two elements share a property

I have a set of numbers S and I want to find the largest subset S' such that for any two elements x,y in S' property(x, y) == True in_relation(x,y) == True. How could I find it? Bruteforcing is an ...
5
votes
6answers
427 views

Algorithm for determining transactions among weekly data series?

I'm trying to develop a small reporting tool (with sqlite backend). I can best describe this tool as a "transaction" ledger. What I'm trying to do is keep track of "transactions" from weekly data ...
1
vote
1answer
35 views

Why use last column of Burrows-Wheeler-Transform

The Burrows-Wheeler-Transform takes a string with length n, creates a matrix with n rows by shifting this string one position to the left for each row. Then the rows are sorted by the first column in ...
22
votes
4answers
22k views

Prerequisite math skill for Introduction to Algorithms (CLRS) book [closed]

I already have knowledge about basic algorithms. Now I plan to study more advance algorithms and I decide to go with Introduction to Algorithms. I'm not sure, do I need to refresh my math's skill ...
8
votes
1answer
4k 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
52 views

How to solve min cost max flow program with brute force

I have a use case where I need to solve min cost max flow problem for nodes < 5. Implementing Cycle canceling or some other min cost max flow problem seems like a over kill for this, is there some ...
1
vote
1answer
122 views

How to implement k-means algorithm on RGB Images?

I want to apply the k-means algorithm on an RGB image data-set. I don't know how to proceed. You can mention basic step by step flow to proceed. I do know basics of Image Processing & OpenCV.
6
votes
1answer
138 views

Finding similar high dimensional vectors

I have two lists (sizes m and n) containing high dimensional bit-vectors. All vectors have the same number of dimensions and use Hamming distance as measure if distance. For each element in the first ...
1
vote
0answers
113 views

Which 3D algorithms does Windows 10's “3D Builder” application use?

Windows 10 ships with "3D Builder", a Universal App that contains utility functions to prepare STL, OBJ, 3DS, and other files that represent geometries for 3D printing. The utility looks like this: ...
2
votes
0answers
46 views

Are there any generic algorithims or Python functions to help find the longest item in a JSON document?

I am trying to log a JSON error message to Google's Cloud Logging platform. Unfortunately, the maximum size message you can log is 8000 bytes and some of the JSON documents I want to log are larger ...
1
vote
2answers
59 views

How to represent complex permissions system in single hash or set of characters?

Eve Online, a game I used to play, had an interesting "permissions" system for account interactions with other apps. The permissions encompassed dozens of individual permissions, each under a ...
-2
votes
1answer
79 views

Unable to Solve Dynamic Programming

I had an assignment on dynamic programming due last night, but I had to turn it in unfinished because i could not understand how to solve the last problem: The state wants to monitor traffic on a ...
11
votes
6answers
2k views

How to teach a script to detect sarcasm? [closed]

I'm currently building a fun script, that basically matches given phrases and gives a predefined response based on the match-points. You can ask it to retrieve some information based on live feeds, ...
3
votes
1answer
420 views

Did eastern PKUFFT algorithm beat FFTW3 (Fastest FFT on the west) 20 fold?

I wonder if PKUFFT is Chinese algorithm/library and is it really better than FFTW, MKL? Edit: I will elaborate. My personal programmers interest is in fast parallel algorithms like FFTW3, which was ...
1
vote
1answer
83 views

tiling algorithm for maximum size of equal-sized tiles

I'm trying to fit an arbitrary number of HD videos on screen so that they all have equal size, maximizing the size of the videos, with no scrollbars appearing. Given N number of tiles of equal ...
55
votes
4answers
13k views

Which algorithms/data structures should I “recognize” and know by name? [closed]

I'd like to consider myself a fairly experienced programmer. I've been programming for over 5 years now. My weak point though is terminology. I'm self-taught, so while I know how to program, I don't ...
5
votes
1answer
106 views

Algorithm to find span intersections in a sorted set

I have a set of items strictly ordered on time. Each item can either be single (no Next, no Previous) or part of a span (with either 1 or 2 further endpoints). For example in the picture A is part ...
1
vote
3answers
129 views

How do I generate multiple hashes that can be resolved to a single value?

I need multiple "random" URLs that just mask the original URL, i.e.: /ABC /CBA /CAB All resolve to /6 I came up with matching a letter to a number and then you can sum them to the single value. A ...
1
vote
1answer
129 views

Best two-way compression algorithm for 32-bit numbers

I need to compress an id for marketing campaigns. The current campaign id is 32-bit integer but obviously this is too long for a customer to type by hand. I would like to compress this to minimum ...
3
votes
1answer
160 views

Burrows-Wheeler transform backward search: how to find suffix index?

BWT backward search algorithm is pretty straightforward if we only need the multiplicity of a pattern. However I also need to find the suffix indices (i.e. positions in the reference string where a ...
5
votes
1answer
232 views

Combinatorial Optimization: Filling a Bag with Sand

I have an interesting "real-world" combinatorial optimization problem that I need to solve programmatically, however I have yet been able to whiteboard a good strategy. The task is similar to the ...
24
votes
5answers
2k views

Is there any good search algorithm for a single character?

I know several basic string-matching algorithms such as KMP or Boyer-Moore, but all of those analyze the pattern before searching.However, if one has a single character, there is not much to analyze. ...
5
votes
1answer
1k views

Accuracy of “calculator algorithms”

I am building a library class that provides functionality for mathematical operations on BigDecimals (and a few on BigIntegers). Now, BigIntegers are quite easy to master and pleasant to use. ...
0
votes
1answer
26 views

Extract the main entity from a body of text for text categorisation?

I'm trying to categorise products based on various fields of data. I've had some success just matching search terms in the product names, but this naive approach doesn't work when it comes to larger ...
2
votes
2answers
127 views

Design for autocompleting words in search engine?

I'm trying to implement an autocomplete feature for a search engine. I have a database of words(stemmed) that occur in the documents that I have for users to search. What I am thinking of doing is: ...
1
vote
3answers
415 views

Does it always require a lot of programming practice before you really master an algorithm? [closed]

I have programmed for several years. And I found it is always difficult to master an algorithm(What 'master' mean here is to understand how the algorithm works and could implement independently in ...
3
votes
1answer
153 views

Neighbourhood points (2d)

I have a 2d coordinates system with some points on it, like this one: Now I am looking for an algorithm (or just some approach) to find neighboured points. So, if you have the coordinates of one ...
4
votes
1answer
163 views

JavaScript functional conversion from flat list to tree

I've been going through the RxJS tutorials http://reactivex.io/learnrx/. Almost all of the exercises involve moving from a hierarchical structure to a flat structure so I thought I'd try to do the ...
0
votes
1answer
37 views

Partition edges into areas

If I have a series of edges that branch and curve, such as in a road network, is there an algorithm that will identify the areas (defined by sequence of geographic points) defined between those lines? ...
8
votes
1answer
154 views

Finding all possible ways of inserting a pattern into a string

I've been thinking about this problem for a while, and I can only find a recursive solution but I'm feeling that there is a dynamic programming way to do it, I just can't figure it out. Is this a ...
5
votes
0answers
89 views

Algorithm to generate all sets of m points in n x n x n cubic lattice which are unique under symmetry

I am implementing an algorithm which is going to be quite computationally complex, and want to try to make sure I'm not doing unnecessary work. There is an n x n x n cubic lattice, e.g. if n=2 this ...
1
vote
2answers
116 views

Algorithm for finding all empty tiles in rectangular grid?

I have a rectangular grid of square tiles, some of which are blocked/filled. I start at a random tile inside the grid with the blocked tiles, randomly placed. I can turn in 90° steps and check whether ...
2
votes
0answers
49 views

Restricted randomization of a binary vector

Suppose I have a binary vector of sample size N with each of the two possible values (e.g., 0 and 1 occurring equally often). For example, if N=10, the binary vector is: 0 0 0 0 0 1 1 1 1 1 Suppose ...
1
vote
1answer
48 views

Keeping track of the number of nodes in the subtree in black and red trees

I was wondering, if I have a black and red tree and I want to keep track of the number of nodes in the subtree, what is the most effective way to do so? I mean how do I work with these values while ...
11
votes
3answers
2k views

longest list of words with matching start and end letters

My friend gave me a problem that he says is easy, but I can't figure out a good algorithm to use to do it. You are given an input of 100 random English words. You have to find the longest string of ...
0
votes
0answers
69 views

Extract significant locations from GPS readings

I'm writing an app that continuously monitors user location 24 hours a day using a mobile phone with readings every 5-30 mins (about 50-300 readings a day). How do I cluster readings and extract user ...
1
vote
0answers
44 views

List all intervals made by inherited array of intervals

i have a grading system which works like this: You have a array of intervals with grades: [9, Inf) => A; [7, 9) => B; ... (-Inf, 1) => F But you can create also inherited grading system ...