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)

-4
votes
0answers
44 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
0answers
21 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
41 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
52 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
26 views

PHP Based algorithms for research [on hold]

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
153 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
34 views

Binary Search scheme alteration [on hold]

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
137 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
40 views

Even/Odd Positive/Negative Integer Determination in Turing [on hold]

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
105 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
175 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
91 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 ...
2
votes
1answer
168 views
+50

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
62 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 ...
-5
votes
0answers
42 views

The algorithm of the soma cube [closed]

I am trying to think of an algorithm which can find all the solutions of the soma cube. Does anyone know on such or can guide me on similar algorithms?
-4
votes
2answers
100 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
159 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
67 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
102 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
2answers
196 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
305 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
78 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
195 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
341 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
77 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
349 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
94 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
219 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
88 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
76 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
250 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
46 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
128 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
108 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
38 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
1k 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
102 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
142 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
118 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
167 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
97 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, ...