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)

5
votes
1answer
134 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
195 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
50 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
189 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
133 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 ...
3
votes
3answers
397 views

Is it better to use a switch statement or database to look through 5,000 to 10,000 instances?

I have some JSON data in this format (5,000 instances for now): {"id":"123456","icon":"icon.png","caseName":"name of case"} I am allowing the user to search for the name of the case and then return ...
1
vote
1answer
29 views

Given n distinct keys, how many different 2-3/Red-black trees can be constructed?

Memory refresher/My understanding: A 2-3 tree is a balanced search tree that allows two types of nodes. 2-node: Normal node with two children. LChild < Parent and RChild > Parent 3-node: ...
0
votes
4answers
310 views

Binary Search seems superior, why did the committee of C++ still have Find in the algorithm library?

I wish to search for an integer in a vector of integer. I have two candidates for the job: Binary Search Find It seems that Binary Search is the best candidate for the job as although I have to ...
0
votes
3answers
155 views

Sorting an array when values are decreased by each swap [closed]

Recently in an interview I come across a question: We have an unsorted array, we need to sort it with minimum number of swap. We have in sort a 'tax' of 1 is deducted from the number we are ...
0
votes
0answers
97 views

Storing simple / flexible pricing logic in the database

I am working on a pricing algorithm where I want to generalize the calculation of certain components/charges. There are 3 components to the charges. 1 - a basic/core charge, 2- a handling charge ...
0
votes
1answer
223 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 ...
2
votes
2answers
554 views

Is Pre-Order traversal same as Depth First Search?

It seems to me like pre-order traversal and DFS are same as in both the cases we traverse from root till the left branch and back to root and then to the right branch recursively. Could any please ...
3
votes
1answer
339 views

What are the essential mathematics topics that a programmer should know in order to learn algorithms? [closed]

Being a electronics engineer, I was never exposed to any algorithms. Now I am a experienced programmer and want to learn Algorithms. I started with CLRS. But I was overwhelmed by the maths in the ...
1
vote
1answer
72 views

Even distribution through a chain of resources

I'm working on an algorithm which routes tasks through a chain of distributed resources based on a hash (or random number). For example, say you have 10 gateways into a service which distribute tasks ...
1
vote
1answer
54 views

Finding minimum path with return?

I'm having trouble understanding a past quiz question I got: Bobby works at Starbucks in San Mateo (V). He is doing quality assurance testing and needs to visit stores in Palo Alto (B), Tenderloin ...
3
votes
1answer
109 views

Need an optimization algorithm

I need this algorithm for one of my projects. I will paraphrase the problem. There are 'n' ropes that have different colored rings on them. (The colors might repeat on the same rope or across ...
0
votes
1answer
67 views

What algorithm pairs blocks so that the weighted average of the two blocks falls within an upper and lower bound?

What algorithm would pair parcels with a high proportion of property x to a parcel with a low proportion of property x so that the weighted average of the two parcels falls within an upper and lower ...
-2
votes
4answers
138 views

Algorithm/research on detecting language of text [closed]

I am interested in finding an approach that will detect what language a string of text is. As Google translate does.
2
votes
4answers
311 views

difference between exponential and logarithmic growth

Why for(k=1;k<=n;k*=2) grows logarathmically = O(logn) but I feel it grows exponentially, as the seq look like 1,2,4,8.... and for fibonacci series people say it grows exponentially. which for me ...
3
votes
3answers
89 views

Detect Order Changes in a List

Let's say you have a list of values that are a b c d e The order on the list might be changed. a c d b e How would you detect this change? We needed something like this when we were ...
0
votes
3answers
97 views

How to limit time period to another period?

For a project planning I have an initial period, lets call it PPStart-PPEnd. The planning is associated with a project. This also has a period PrjStart-PrjEnd. PrjStart and PrjEnd are fixed, and can ...
0
votes
0answers
74 views

Distributing Contestant Entries Between Multiple Bins, Is this Knapsack?

I am an algorithm novice and am faced with a rather difficult problem. I am working with contests. There are contestant - individual player entry - contestants can have multiple entries into a ...
3
votes
4answers
318 views

Which mathematical properties apply to XOR Swap algorithm (and similar bitwise operator algorithms)?

Assume you have two variables a and b, and you need to swap them, and for whatever reason, making a temporary variable for storage is not an option. This is the algorithm in pseudocode a ← a XOR b b ...
1
vote
1answer
69 views

Mapping values over a curve

I have a value between 0 and 8000 and I want this number to resolve to another number between 0 and 2000. I could just divide it by 4 but I have a special need here. For values above 4000 I want the ...
0
votes
5answers
243 views

Mapping 40 unique integers to 41 and back

This was a question proposed by a friend of mine. Define an algorithm that, given 40 unique integers in the range 1-1000, returns 41 unique integers in this range. Given these 41 integers, we must ...
1
vote
2answers
102 views

How to reduce close points

input: C matrix 2xN (2D points) output: C matrix 2xM (2D points) with equal or less points. Lets say we have C matrix 2xN that contains several 2D points, and it looks something like that: What we ...
0
votes
1answer
57 views

expressing the speed of a sorting algorithm

How would I express the speed of the following sort algorithm? I know bubblesort is n^n (er, I mean n^2...as someone pointed out below). In the following the array decreases each time you call it ...
0
votes
0answers
137 views

What is the purpose of chunking strings in natural language processing?

I see many examples of libraries that use a 'chunker' and also people asking how to write chunkers, but what is this for and why do we need it? Isn't it enough to split a text by whitespace or other ...
0
votes
0answers
92 views

R* Tree work with dynamic data

I'm searching an algorithm to store my data (which are moving objects' coordinates) and allow me to query objects within a specific radius of a specific point. I came up with R* Tree which is said as ...
2
votes
0answers
188 views

Match buyers and sellers based on date ranges and quantity of shares

NOTE: This is in reference to the question I asked on Stack Overflow but was told to post this here I'm building a trading application that matches buyers/sellers that own subscription. Subscriptions ...
6
votes
3answers
186 views

Maximizing number of nested triangles

There is a finite set of points on a plane (about 1500 points in the current task). I need to construct triangles on those points such as each triangle lies completely inside one larger triangle: ...
2
votes
0answers
104 views

Solving geometric constraints with Minion

I am doing research on squares, and I thought of using constraint-satisfaction-problems solvers for proving or disproving some conjectures. As a simple example problem, consider the following task: ...
1
vote
2answers
284 views

2 closest points between 2 rectangles

On a 2D plane, I have 2 rectangles. I want to find the closest pair of points (one on each rectangle), which are closest to each other. By points I mean the corners of the rectangles. And no, they do ...
0
votes
0answers
66 views

Creating A News Feed with Relevant Data for App

I'm creating an app that currently allows users to create topics, vote in topics, follow topics, and chat in topics. Currently working on creating a News Feed like Facebook or Twitter that brings ...
1
vote
2answers
123 views

Algorithm for defragmenting cross-pipe issues in a network for routing signals through?

I have a network I'm responsible for routing signals through. You can think of the network as a directed graph of nodes (hardware) but each edge is really a pipe capable of fitting a specific ...
1
vote
1answer
259 views

Is there already a “Binder” data-structure?

I was thinking of a data structure that I cannot describe better than with the word "book", or more exactly "binder". I was wondering if this had already been implemented in libraries like Boost or ...
1
vote
1answer
98 views

Implementation/Representation of Symmetries in Chessboards

In a 8X8 chessboard, I was wondering how to implement the symmetry of the board. A lot of positions are just mirrors or rotations of one another (with no pawns or castling capabilities left the ...
0
votes
1answer
143 views

detect if a combination of string objects from an array matches against any commands

Please be patient and read my current scenario. My question is below. My application takes in speech input and is successfully able to group words that match together to form either one word or a ...
2
votes
1answer
145 views

Draw graph of a function whose characteristics are unknown [closed]

Suppose I have a function. I have code that, given an x value, produces a y value. I can assume that the function is somewhat mathematically sane, not something crazy like an ...
2
votes
2answers
224 views

How do you program a way to create mathematics formulas?

For one of my project ideas, I want to create a dice rolling app. It would allow people to setup somewhat complex combinations of dice roll cascades in a visual way. I have a pretty good idea on how ...
2
votes
3answers
468 views

Questions about God's algorithm and Rubik's cube

I am creating Rubik's cube solver. It will be good if solver could solve cubes of any size and if it could generate short solutions. I have found many various information about God's algorithm, which ...
0
votes
1answer
187 views

Weight-maximizing (weighted vertices) path algorithm

I am looking for description (name of algorithm, code, pseudocode, etc.) that can help me frame this problem and find the appropriate recursion and the most efficient solution. Problem: Given a ...
0
votes
3answers
1k views

Time-complexity of nested for loop

I have loops like this: for(int i = 0; i < n; i++) { for(int j = 0; j < i; j++) { sum += 1; } } It's O(n * ), but I'm not sure what the j < i loop is. I have some tests ...
1
vote
4answers
229 views

How to trace logical errors in algorithms [closed]

I am beginner in algorithms. Last year I participated in Google Code Jam. One of the major issues I faced during the competition was my code was working fine on my test cases, but when I submitted on ...
5
votes
1answer
123 views

Bloom filters or similar, but with no false positive

To improve some lookups, I am considering the use of Bloom Filters. But in my use-case, the most probable outcome is that the element do exists in the target set. Bloom filters can have false ...
1
vote
2answers
364 views

proposed algorithm and representation of an algorithm

What is the difference between an ambiguity in a proposed algorithm and an ambiguity in the representation of an algorithm? I have done some research and found out that ambiguity in the ...
1
vote
4answers
841 views

Is there any specific reason to use “else if” clause?

We all use if ..else if.. else. But still I'm confused as to why we use else if. Where if does the same thing as else if. So why are we using else if? Any specific reasons behind this? Is there ...
2
votes
1answer
114 views

How to do inference in a card game?

In the game there are 5 players, each with 8 cards in hand. No other card is present. Using Monte Carlo (MCTS) I run many simulations of the game from the current state to the end of the match. In ...
0
votes
2answers
324 views

What graph traversal algorithm should I use?

I would like to write an algorithm which can traverse a graph and hopefully later I can implement it to use for an indoor navigation system. The graph would come from floor plans of a building and ...
0
votes
2answers
298 views

Quick algorithm to find matches between two arrays

I'm faced with the following problem: I have an array which is produced by the parsing of a yaml file which contains patterns in the following structure. "Programming books" Title: a ...