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
vote
0answers
65 views

Dispatch Algorithm for logistics - Batch assignments

basically, I'm trying to implement an algorithm that dispatches drivers to deliver batches (a batch is a collection of orders). The algorithm takes all the batches and all the drivers available, then ...
7
votes
8answers
2k views

Relation between object orientation and algorithms

As I read some algorithms textbooks, they are full of clever procedures for some problems (sorting, shortest path) or some general methods (recursive algorithms, divide and conquer, dynamic ...
1
vote
4answers
139 views

What do polynomial algorithms entail?

From here, I know it is that an algorithm that... ...is said to be solvable in polynomial time if the number of steps required to complete the algorithm for a given input is O(n^k) for some ...
0
votes
1answer
102 views

Measure and locate areas of similar value in an image

I saw this picture online and wanted to see if I could create an algorithm to give ordinary images an effect like this: http://justinlivi.net/wp-content/uploads/2011/01/Living_In_Digital.jpg My idea ...
4
votes
2answers
150 views

Making a sequence strictly increasing by joining neighboring numbers using the smallest number of moves

I've got a following problem to solve: You are given a list of positive integers [x_1;x_2;...;x_n]. You are allowed to change 2 integers standing next to each other to one equal to their sum. (So ...
5
votes
4answers
269 views

How to convert the following node evaluation procedure to a non recursive solution?

I have the following recursive method. It evaluates a node (that represent a logical expression), using deep first search traversal : EvaluateNode(Node node) { bool result; switch(node.Type) ...
0
votes
2answers
375 views

Algorithm for merging multiple rows of data

I need an algorithm to merge multiple rows for data, where one column is the index column and if one or more rows have the same index value merge the column values into a single row, and lastly sort ...
1
vote
2answers
75 views

Resolve dependencies using before-after constraints

What i would like to do is the following. (Not sure if this question should go to StackOverflow, or here) Consider a datastructure like this: interface IAction { IAction[] afterActions() ...
2
votes
1answer
110 views

Closest Point to Moving Target

I have a target which is constantly moving, and only its current position is ever known. I also have about one hundred objects surrounding it, and for each of these only the current position is ...
0
votes
0answers
70 views

Finding all Triangular Hulls in a 2D Point Cloud

My question: Given a set of 2D points, enumerate all triples of points such that no other points is inside the triangle formed by those 3 points. I'm looking for something better than this: // The ...
-2
votes
3answers
527 views

Situations when O(n^2) better than O(n*log(n)) [duplicate]

Is there any situation a sorting algorithm of time complexity O(n2) could be better than an O(n log(n)) sorting algorithm in any way?
2
votes
2answers
189 views

Sudoku hidden sets algorithm

I am writing a solver for the game sudoku. I am trying to implement the hidden set check in it and I can't figure out a way to do it well. I need to find out if there is a set of cells of size N in ...
2
votes
1answer
216 views

Genetic Algorithm's Tournament Selection limit to be selected

I started working again on a Genetic Algorithm and i'm trying a lot of operators and ways of selection. When I made the Tournament Selection , I noticed that it gets really easy to always get the top ...
4
votes
1answer
136 views

Algorithm to assign edges to smallest possible polygons?

I'm designing a procedural city generator, and the first step of the generation process is the creation of city streets. These streets extend out in a straight line to a point, then they can either ...
5
votes
4answers
371 views

Most efficient way to generate all descendents of all nodes in a tree

I'm looking for the most efficient algorithm to take a tree (stored as either a list of edges; OR as a list of mappings from parent node to a list of child nodes); and produce, for EVERY node, a list ...
2
votes
2answers
894 views

Efficient method for finding closest point to a line segment from a set of points including line segment's vertices

Let's say I have a list of points (in my case, point objects in a Python implementation). I then have a line segment connecting two of these points. I want to know if there's a way to efficiently ...
3
votes
2answers
391 views

Looking for a DP algorithm for a specific packing problem

I have the following problem to solve: Given a ferry with length d and a list of n cars conataining their length we must load the cars on the ferry in an order in which they appear in the list on 2 ...
0
votes
1answer
530 views

How to remove a middle element from queue?

I had a question, about how to remove an element from middle of the queue , without disturbing the order of other elements. E.g. Queue before operation:- <| a b c d e |< Queue after ...
1
vote
2answers
85 views

Greedy algorithms - minimising “parentheses rotatons” in order to get a valid expression

I'm preparing for an exam on which there will be problems solvable by DP, greedy algorithms. And one of the problem is - given a string containing parentheses in no particular order return a minimum ...
8
votes
2answers
568 views

How do personal assistants typically generate sentences?

This is sort of a follow up to this question about NLG research directions in the linguistics field. How do personal assistant tools such as Siri, Google Now, or Cortana perform Natural Language ...
3
votes
2answers
99 views

Method for determining if a line segment is an external edge of a Delauney triangulation?

I've created a Delauney triangulation of a set of points. Now I want to iterate over the triangulation and remove any line segments/edges on the exterior for which the following are true: The ...
3
votes
1answer
158 views

What algorithm can be used for a more complex version of the bin packing problem?

I'm currently developing a plugin for World of Warcraft in LUA to help optimize a recently introduced part of the game, namely Garrison missions. A Warcraft Garrison (basically a player fortress) has ...
2
votes
3answers
247 views

Test & remove, or always remove

I have a function to show or hide a certain UI control. In my example case below, the framework is jQuery I'm using for an event to show a tool tip that may fire a LOT (based on mouse movements) - but ...
4
votes
4answers
450 views

Why are return values from compare functions in many languages defined loosely?

Many languages define that compare functions should return ANY negative value, zero, or ANY positive value. Is there some reason that it shouldn't be clearly defined as -1 0 and 1? Does a wide range ...
0
votes
2answers
216 views

Big-O notation for other cases

I was just reading answers to a question Plain English explanation of Big O From that i came to know that Big-O notation is just an "upper bound" of the complexity of an algorithm? But can we apply ...
-1
votes
2answers
605 views

What is the simplest and universal algorithm for parsing C++ code? [closed]

I need to do some project specific automatic checking of source codes written in C++ Limitations: Algorithm and its implementation should be simple, easily maintainable, extendable and ...
2
votes
1answer
146 views

How to randomly get or find a sub-tree (include root node) from a given tree that contains n leaf-nodes

I have a non-binary tree. I want to randomly find a "sub-trees" that are connected from root to leaf which must have at least n leaf-nodes (leaf-nodes of sub-tree must be leaf-nodes of given tree). ...
1
vote
2answers
354 views

Lower and Upper bound of an algorithm

I am learning about analysis of algorithms. I came across the term "upper bound" and "lower bound" in "worst-case" running time of an algorithm. Are they applicable to only the "worst case" or can ...
1
vote
2answers
476 views

Is it possible to protect client side algorithms 100%? [duplicate]

If you had a pretty novel idea that involved a new algorithm. Like lets say you were the first person to think of orbitz.com or kayak.com (travel sites) and you were able to and wanted to implement ...
0
votes
0answers
61 views

Syncing different nosql datasources efficiently

I have two dbs I am dealing with right now - Elasticsearch and Mongodb. Mongodb is legacy in the application in that I am not happy for its presence but it is there and in use, I am interested in ...
0
votes
2answers
128 views

Big O of 2 interesting Algorithmic functions [closed]

This is my homework(I have attempted it, and there are no references for questions like these) Determine whether or not these functions are polynomial run time and determine the constant c for ...
0
votes
1answer
477 views

Which weak algorithmic strategies I have that lead me to failing coding this simple algorithm? [closed]

I am a graduate student in computer science who graduated recently from a famous university. I applied to my first software engineering job and I failed the technical interview by failing to answer ...
1
vote
1answer
160 views

Algorithm to find the closest summation of elements in a list to a given number [duplicate]

Say I have a list {1,3,7,2,11,8,2} and I want to take x elements from the list and get the value 15.5. Is there an algorithm that would give me x elements in a list that, when added together, get ...
1
vote
1answer
89 views

find the minimum number of sets

Let's explain my question with example I have some integer sets for example S1 = {2,3} S2 = {2, 5} S3 = {4, 5} S4 = {4} S5 = {5} And I have sample set Ssample with 4 elements {2, 3, 4, 5}. So ...
0
votes
1answer
1k views

run time of nested while loop inside for loop

I'm here to clarify my understanding of the run times of these 2 algorithms: Algorithm1(n): For i = 1 to n j = 1 while i+j < n j = j+1 and Algorithm2(n): For i = 1 to n j = ...
2
votes
3answers
4k views

Efficient algorithm to count number of substrings divisible by 3

Given a string of decimal digits, I have to find the number of all substrings divisible by 3 in the range L to R [both inclusive], where L & R are index[1-based] of the specified string string ...
1
vote
1answer
112 views

What is the minimum cost graph inside a strongly connected component, which connects every vertex?

So for MST there are 2 possible definitions in an undirected graph. Keep in mind that in an undirected graph the MST algorithm always has n - 1 edges and no cycles. In an undirected graph, it doesn't ...
1
vote
3answers
240 views

Is there an algorithm to determine the amount of work needed to keep workers busy?

I wrote a multi-threaded program that randomly generates strings, and after generating, checks to see if the string contains a certain value. Namely, StringGenerator and StringChecker. What I'm trying ...
2
votes
4answers
534 views

Range of values based on key values

I'm trying to implement a method of searching trough a large amount of 2D points for those that match a certain range. I'm thinking of creating HashMaps for <X, Point> and <Y, Point> but ...
2
votes
1answer
255 views

Solving a Sudoku variant with an unknown element

I recently stumbled upon a special Sudoku variant and am now struggling to effectively solve it programatically. Consider the following initial 6x6 grid: The rules The red question mark is ...
3
votes
1answer
69 views

Creating a tree of objects based on the commonness of its properties?

I have an algorithm problem. I'll simplify the issue, because most of what I'm dealing with has nothing to do with the algorithm I need. Basically, I have a list of objects that each have properties. ...
15
votes
2answers
5k views

Algorithm to merge two sorted arrays with minimum number of comparisons

Given are two sorted arrays a, b of type T with size n and m. I am looking for an algorithm that merges the two arrays into a new array (of maximum size n+m). If you have a cheap comparison ...
2
votes
0answers
145 views

Design an algorithm with network flow

Given a matrix A with 0 and 1 entries. Neighbours of a[i,j] are a[i-1,j], a[i+1,j], a[i,j-1] and a[i,j+1] (if exists any). Tow neigbour entries are an Improper pair if they have not equal values. if ...
3
votes
1answer
210 views

Hash function with uniqueness guarantees and controllable entropy

Is there a class of hash functions that meets the following specs: Upper and lower bound can be specified Uniqueness is guaranteed as long as the input is between the upper and lower bounds Amount ...
2
votes
1answer
148 views

Silverlight-based “area of influence” algorithm

I am in the process of developing a tool for a game called MechWarrior: Online which defines a map of an area of space called the Inner Sphere. Essentially, this map is a set of points (planets) on a ...
0
votes
1answer
269 views

Shortest path to visit all nodes [duplicate]

I am given a set of tourist attractions(nodes identified by x, y) and i need to find the shortest path to visit them. The way i thought of it, is i will ignore if there are streets available and ...
1
vote
0answers
157 views

Algorithm for sweeping a 2d shape along a curve?

I am trying to create a graphics application where the user can use an arbitrary shape as a "brush", which will be swept along the drawing path. The shape may be transformed along the path (rotated, ...
2
votes
3answers
165 views

How to code a one-sided virtual economy

I'm attempting to make an online game with a mini-economy in it. The challenge is that the only person selling anything will be the website itself, and hence the supply and demand curve doesn't apply ...
1
vote
1answer
88 views

Algorithm to find the fewest number of values (from a set of values) where the sum equals a value (+ one more condition)

The simplest way to explain this is with an example. You're given then number 19 and you have a set of numbers to choose from: 1, 2, 3, 4, 6 When choosing values from the list (which can be ...
1
vote
3answers
337 views

Concept for dealing with recurring appointments

Our company implemented a calendar system a few months back with recurring appointments, using iCal strings to store the recurring appointment criteria. We are starting to run into performance ...