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
17 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
47 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 ...
-2
votes
0answers
27 views

Source of extensive, battle-tested Unit Tests [on hold]

Where can I find solid, proven unit tests for common data structures and algorithms? I'm giving an introductory class, that covers basics such as lists (linked, array-based, tree-based, etc.), ...
-2
votes
0answers
31 views

Find the number of increasing Sequence of length K

Let we are giving a Array we have to find the number of increasing sequence of length K. 1 2 3 1 1 For the first window of [1, 2, 3], there are 3 non-decreasing subranges so the answer is 3. For ...
0
votes
0answers
24 views

Line wrapping with variable number of lines… almost there! [on hold]

I'm fiddling a way to split a string in a variable number of lines. It's working but I would like the lines to be a bit more even in size so that they take less space horizontally. I've been over it ...
0
votes
3answers
100 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 ...
-2
votes
0answers
32 views

Algorithm for 2D general sweep - Implementation? [on hold]

Please help! I have been reading and re-reading two papers: Approximate General Sweep Boundary of a 2D Curved Object and Polygonal boundary approximation for a 2D general sweep based on envelope ...
0
votes
0answers
30 views

Algorithm for intersection of two convex polygons among set of m convex polygons in a plane

There are set of m convex polygons(p1, p2, p3…pm) in a plane. Pi contains ni number of vertices. All total n1+n2+…+nm=n vertices. Two convex polygons intersect if either their boundaries intersect or ...
26
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. ...
-4
votes
0answers
42 views

How to print The sequence of numbers in structure array [closed]

I have the task which cannot be solved. My task is create a sequences of cards. How print my sequences ? i really need help. my solution #include <iostream> #include <fstream> #include ...
2
votes
0answers
30 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 ...
-2
votes
0answers
44 views

What are the Steps/Algorithm to load/Parse an XML File? [closed]

I want to write an xml parser by my own, its a project given to me, and i should complete it, i know to search for a string, load files into memory using vectors, but is theres a way i can use this to ...
0
votes
1answer
73 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) ...
-4
votes
0answers
75 views

Divide an Array into n subarray such that each subarray have equal sum? [closed]

You are given an array of a given length. Now we have to determine whether we can Divide the array into n sub-array such that all of them have equal sum . Note: Each sub-array may or may not have ...
-1
votes
0answers
23 views

Best way to aproach creating an MRP [closed]

Ive been ask if I could create an MRP (Material requirements planning) program, from what I have read its seems like a complex program manager, I've been working on it for a couple of days now, and ...
0
votes
2answers
87 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
143 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
0answers
44 views

All pair algorithm implementation [closed]

I need to know how to implement all pair algorithm in java... i am newbie for this kind of algorithm implementation .kindly help me with some suggestion. I have to generate possible test cases for ...
0
votes
0answers
77 views

RGB => HSL => hue range name conversion algorithm off by positive 60 degrees [migrated]

Background For practice (in ruby) I am implementing some color conversion algorithms. I have attempted to convert pseudocode avilable on EasyRGB.com to Ruby. The conversion seems to be working fine. ...
0
votes
1answer
67 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 ...
0
votes
1answer
79 views

Easiest algorithm implementation of a game tree? [closed]

I want to create an algorithm to play out all possibilities in this game and print the most optimal moves. (This is a variant of mancala. You don't need to play the game to understand my code (the ...
0
votes
2answers
90 views

Track a series of choices with a single number

I want to track a series of scored questions in a single number (the total score). Is that possible? and how? For example, I have 30 questions with either 3 or 2 choices. For any given question, the ...
0
votes
0answers
49 views

Excel-like column numbering [migrated]

I have a working code (below) to convert a number to Excel-like (A...Z AA...AZ BA...BZ ...ZA-ZZ) column codes (headers). For simplicity I limited it to 1 or 2 character codes. My question is: ...
0
votes
0answers
51 views

Test if a point is inside or outside a 3D polygon

I'm wondering if there is an algorithm (or a code written in FORTRAN) that gives whether a 3D point is inside or outside a polygon having triangles as faces (an .stl file from gmsh for example). Most ...
0
votes
1answer
85 views

Finding same numbers in a matrix

I have a question here and I am trying to find a solution of it. But I want to see some other opinions as well. The problem is the following: There is a matrix NxN which holds integer numbers. ...
1
vote
1answer
87 views

Generate algorithm to solve peg solitaire

I know that with regression it is possible to generate a mathematical function based on experimental data. I was wondering, maybe there is a way to generate something more complex. I have a single ...
3
votes
1answer
76 views

How do I efficiently send notifications for different events to different users based on their preferences?

I'm creating a notification system for particular events. A user can set the criteria that match particular events (ie. New item, changed item, closed item etc) Items have different characteristics ...
1
vote
2answers
95 views

On-the-fly, random partition of a range of numbers [0,N] in groups of max M size

Suppose that you have a range of numbers from 0 to N that you want to randomly separate in groups of max M sequential numbers. This is easily done with a bitmap and a random number generator, but it ...
4
votes
3answers
110 views

Algorithm Analysis: In practice, do coefficients of higher order terms matter?

Consider an^2 + bn + c. I understand that for large n, bn and c become insignificant. I also understand that for large n, the differences between 2n^2 and n^2 are pretty insignificant compared to the ...
0
votes
0answers
47 views

Algorithm for sport tournament bracket tree

I would like to develop a library that: receive n players in input response with the tournaments brackets in output. I would ask you what kind of algorithm I have to use to choose the correct tree ...
1
vote
1answer
39 views

What algorithm-family or problem-space description fits? Industrial process feeding ingredients to process

Our process continuously feeds (normally <= 8) ingredients from a choice of hundreds, using 3 feeders only. So if ingredient count X is > 3, 3 through X are stirred together in a batch process and ...
2
votes
0answers
72 views

In a mutual credit network, how would you program an automatic jubilee?

A little explanation might be needed. I mean mutual credit the way that it's defined here: a type of alternative currency in which the currency used in a transaction can be created at the time of ...
1
vote
2answers
164 views

Most Efficient way to Compute the sum of divisors of N (1 ≤ N ≤ 1 000 000 000)

I want to write a code which computes the sum of divisors of a number N(1 ≤ N ≤ 1 000 000 000), excluding the number itself. However, I need an efficient way to do it. It suppose to print the answer ...
2
votes
1answer
117 views

moving around virtual keyboard

I'm creating virtual keyboard using javascript/html/css. And I can't find a good algorithm for moving from one button to another in different directions (top-bottom, left-right). Lets say I ...
1
vote
1answer
110 views

Is this still a Greedy Algorithm

As a preface I will state this is for a homework assignment. I have already discussed this with the professor and will not be using this design. This purpose of this question is whether or not the ...
3
votes
2answers
198 views

Algorithm for finding automorphisms of a string in O(n) time

I recently stumbled upon this problem, which requires a solution in O(n) time, and I'm struggling to find a correct one. The obvious, naive solution runs in O(n²) time. Any ideas? A string S = ...
3
votes
2answers
205 views

Why Do B+ Trees Have a Minimum Occupancy of 50%?

As far as I can tell, the basic operations (add, delete, search) on a B+ Tree would function the same if minimum occupancy was 1, or 1/3, or any other function on node size. All the sources available ...
2
votes
2answers
135 views

Finding shortest path between nodes with a twist

Note: if you feel that I should include code, please tell me. I am solving a problem of finding shortest path between nodes. I am given the vertices between nodes, however they are one sided (ie you ...
0
votes
0answers
51 views

Find 'Connected Components' in undirected, unweighted graph coded as a 2d array

Given an undirected, unweighted graph coded as a 2d array, how can I find the number of different connected components? Example There is the following 2d array (I'm not putting any brackets to ...
23
votes
8answers
6k views

Function guaranteed to never return the same value twice [closed]

This is a question I was asked at a job interview, and I can't figure out the answer they were looking for, so I'm hoping someone here might have some ideas. The goal is to write a function that is ...
0
votes
1answer
55 views

Simulated Annealing Contradiction?

The entire idea of simulated annealing is to avoid getting stuck in local optimums, which is why sometimes, a worse solution is accepted. However, simulated annealing will automatically accept a ...
0
votes
1answer
183 views

Why does this evaluation function work in a connect four game in java

I am exploring how a Minimax algorithm can be used in a connect four game. I was looking through a program and found this evaluation function. private static int[][] evaluationTable = {{3, 4, 5, 7, ...
0
votes
1answer
52 views

Rideshare algorithm to be used for scheduled and adhoc journeys

I need some help writing some pseudo code for a rideshare system for taxi drivers. The idea behind it is that it would combine real-time incoming taxi journeys and pre-bookings in real-time. The ...
0
votes
1answer
130 views

What is the justification for the running time of this loop?

I don't understand why the running time of the following loop is n+2 ? Also why the running time of the statements inside the loop is n+1 ? Double test(int n){ int sum=0; -> 1 time ...
3
votes
4answers
295 views

Mark x% items in stream

There are n items (n is known and > 1,000,000,000). I want to randomly 'mark' x% of n-items in stream. (n and x are known) Items are in stream ,one directional (you can't go back) processed item ...
2
votes
1answer
87 views

Finding the fewest sets which contain all items

I am wondering if there is a known algorithm for solving the following. Data: There is a number of sets containing items. An item can be a member of more than one set. Aim: return the minimum number ...
1
vote
0answers
67 views

Walk Tree vs Zhang and Sasha Algorithms

I need some help understanding how two tree comparing algorithms differ. I am working with Microsoft's XmlDiffPatch (http://msdn.microsoft.com/en-us/library/aa302294.aspx) which compares two xmls. The ...
0
votes
1answer
133 views

Which algorithm best fits the following problem [closed]

I'm looking for the right algorithm to solve a specific problem. I hope that there are known algorithms that can be used. The problem definition Given a set of 'options' (~10) A session is defined ...
4
votes
2answers
176 views

Extracting first and last name from a single name field

I'm working with the Twitter API which provides only a single field called name, which includes the full name of a person. The application that we're constructing requires a first name and a last ...
0
votes
1answer
85 views

Handling the process of large-scale lists [closed]

What are the efficient ways to process huge lists (+10 millions), and things to consider while manipulating huge lists. First question, when should I use recursion, and when I shouldn't. In both ...