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)

0
votes
1answer
52 views

Closest Point to Moving Target

I have a target which is constantly moving, and only its current position is ever known. I have about one hundred objects surrounding it, also only who's current positions are ever known. I am ...
0
votes
0answers
58 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
185 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
149 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
143 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 ...
3
votes
1answer
101 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
197 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
136 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
299 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
101 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
75 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 ...
-4
votes
1answer
123 views

it is possible to implement keyloggers in java [closed]

I am researching on keyloggers and as a part of my research I would like to know if its possible to implement keyloggers in java edit * How can i create a keylogger in java or to be precise what ...
6
votes
0answers
219 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
75 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
112 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
233 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 ...
3
votes
4answers
310 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
199 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 ...
-2
votes
2answers
378 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 ...
1
vote
2answers
88 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
140 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
385 views

Is it possible to protect client side algorithms 100%?

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
36 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
119 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
261 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
99 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
82 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
444 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
3k 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
51 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
181 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
150 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 ...
1
vote
1answer
146 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
60 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. ...
0
votes
0answers
47 views

Global relabeling heuristic: Push-relabel maxflow

I have a correct, working implementation of the preflow-push-relabel maxflow algorithm [2]. I am trying to implement the global relabeling update heuristic [3], but have run into some issues. I have ...
15
votes
2answers
2k 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
106 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 ...
2
votes
1answer
150 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
120 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
178 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
103 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
153 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
66 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 ...
0
votes
3answers
139 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 ...
29
votes
7answers
4k views

Is there any algorithm pattern to protect any content in the web to ensure I am the first one who created it?

A few years ago there was this hacker (don't remember who he was) that full disclosed a vulnerability in a given system, but to make sure nobody took credit for that, he created some kind of PGP key. ...
2
votes
0answers
53 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 ...
0
votes
1answer
95 views

Permutting a list of numbers in order to get a list which satisfies given condition

Here is algorithmic problem I'm trying to solve: Given a list [x_1,x_2,...,x_n] return a permutation of elements of the list [y_1,y_2,...,y_n] (where for each i we have y_i = x_j for only one j) ...
0
votes
2answers
108 views

Porting an algorithm implementation licensed under GNU GPL v3

I'm working on a JavaScript port of a red-black tree implementation in Java from the book Algorithms 4th Edition, by Sedgewick and Wayne. I believe that my JavaScript port qualifies as a derivative ...
2
votes
1answer
160 views

Matching algorithms in context of data quality problems

I work for an organization that has lots of databases containing person information. The data quality is poor. One case was a surname I found like this (this is the worst-case scenario): Mark ...
0
votes
1answer
97 views

Matrices calculations on partial shape matching

I'm working in a shape recognition project where it is supposed for me to develop an application that receives two images: an original one and a sketch made by a user. I am supposed to detect contours ...