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
0answers
22 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 ...
-1
votes
0answers
33 views

Is there an optimal way to find the best division of an interval of some positive integers?

I am struggling with a conceptual problem. I have positive integers from an interval [1800, 1850]. For every integer from that interval, let's say (without loss of generality) 1820, I have about 3000 ...
-6
votes
0answers
28 views

Getting wrong answer on online judges [on hold]

I have written the following code for the http://www.spoj.com/problems/LASTDIG/, which I have tested thoroughly. I have tried running it on all the corner cases and also on some very typical inputs ...
4
votes
2answers
73 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
178 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) ...
-3
votes
0answers
20 views

Listing all possible binary search trees [on hold]

I'm stuck trying to write a program that lists all possible binary search trees that has n values from 1 to n. I tried to solve it by recursively listing all subtrees, but have trouble implementing ...
0
votes
2answers
118 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 ...
-4
votes
0answers
66 views

How to ensure that the Programmer is not reselling my App? [on hold]

I'm a teacher. I am paying a programmer to built my App to teach Spanish. I have created the whole App and every single functionality, activity, design, look, content, etc. The programmer I hire is ...
1
vote
2answers
57 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() ...
0
votes
1answer
45 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
55 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 ...
-3
votes
0answers
31 views

PHP Based algorithms for research [closed]

I am PHP programmer (Experienced ). Now i want to research in PHP algorithms and want to write a paper on a specific PHP algorithm. I need help : From where to start. What should i do . Some ...
-2
votes
3answers
163 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?
-1
votes
0answers
35 views

Binary Search scheme alteration [closed]

I'm having a bit of an issue with programming an algorithm..... below would involve some of the details of the assignment; now before you begin to say that I should actually attempt, in solving this ...
2
votes
2answers
142 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 ...
-3
votes
0answers
47 views

Even/Odd Positive/Negative Integer Determination in Turing [closed]

I'm writing a program for my comp. sci class where I have to determine if an inputted integer is even or odd, and if it is positive or negative. This is my code, var number_1: int loop put "Write a ...
2
votes
1answer
112 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
95 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
184 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
94 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
291 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
66 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
73 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
2answers
104 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 ...
4
votes
0answers
168 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
69 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
106 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 ...
0
votes
0answers
17 views

What is an efficient method for retrieving a column from a 1D array? [migrated]

An example in any language would help, though in the end I am going to be using either Ruby or JavaScript/CoffeeScript. Basically, I have a 1D array of pixel values. For example, I have an array ...
1
vote
3answers
223 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
306 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 ...
-3
votes
0answers
80 views

Algorithm : What is the scenario depicted in the below problem and how can it be solved?

Consider the following input: “4 2 1 4 2”. The first friend to arrive brings a box of length ‘4 cm’. height is same for all boxes. The second to arrive brings a box of length ‘2 cm’ and so ...
0
votes
2answers
197 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
347 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
80 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
134 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
362 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
29 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
95 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
226 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
89 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
77 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 ...
-3
votes
0answers
12 views

Recursive solution for 3n+1 [migrated]

I just like to do simple recursion. For a number if it is even then it'll approach to (number/2) and if odd then to (3*number+1). How many time it'll occur to reach 1. for 10 10-> 5-> 16-> 8-> 4 ...
0
votes
1answer
266 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
47 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
178 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
132 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
114 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
58 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
39 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 ...