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)

3
votes
1answer
163 views

What advantages are there to using Flex/Bison over just writing a compiler straight in a programming language?

I have written an Interpreter / Compiler simply as a programming algorithm using features such as recursive functions and concepts from finite-State machines. To me, these things are ideally suited to ...
1
vote
1answer
223 views

Assembly vs. algorithmic languages (like C, Algol, etc)

Usually, computer science papers describe algorithms in Algol-like pseudolanguage, similar to Pascal or even C/C++. But Donald Knuth uses his own assembly language (MMIX). Are there any good known ...
1
vote
2answers
147 views

Finding common prefixes for a set of strings

I am trying to find common prefixes for a sorted set of strings. i.e. if the following strings are given: AB123456 AB123457 ABCDEFGH ABCDEFGX1 ABCDEFGY XXXX then my function should return three ...
0
votes
0answers
57 views

Does multiple Bloom filters make sense?

In order to decrease the number of false positives, I came up with a couple of possible solutions. Create two different types of Bloom filters; eg. filter1 using 3 different hash algorithms, filter2 ...
2
votes
1answer
194 views

Quickest sorting algorithm for sorting a low number of integers

I am making a program on my spare time that I want to run as quickly as possible. The program is written in C. A large set of the procedures operate on pointers to 7 integers that are sorted by their ...
-4
votes
1answer
106 views

how to write example code for this sequence number? [closed]

I want to ask you a question. How is the example code (just an algorithm in any language programming) for this sequence: 1, 2, 3, 1, 4, 2, 5, 3, 4, 5, 1, 6, 2, 7, 3, 6, 4, 7, 5, 6, 7, 1, 8, ... It ...
0
votes
1answer
100 views

Method ordering

This is the type of question that one would probably get in an exam, but now it happens to be in the real word. :-) I would appreciate some advice regarding the datastructure/algorithm that can be ...
1
vote
2answers
64 views

multiple comparison sorting

I have a set of songs where I want to sort them by a particular quality. In order to do this (by crowdsourcing) I will present users with a comparison between two songs. The user will then choose ...
1
vote
4answers
244 views

Order by different Enum property each row

So I have a list of DefaultSearchModal items that have an enum called TypeSearch in every list item. I would like to order the list to have a different enum property each row. So if you have an ...
0
votes
1answer
72 views

How to compute data for charting?

I'm building a charting component that displays data directly from the raw data records. It should be able to filter data (subset) and then perform some rudimentry maths on the data (sum, avg, etc). ...
1
vote
0answers
52 views

Incorporating custom Algorithm in SOLR-LUCENE , before Indexing?

CURRENT FLOW: I am using a custom algorithm(presently in php) to rank the MYSQL records before INDEXING it to SOLR . WHAT I WANT : Is it possible implementing this ALGORITHM(may be in JAVA) inside ...
0
votes
1answer
38 views

Min weight feedback edge set with DFS?

Exercise from The Algorithm Design Manual 6-10. [4] Let G = (V,E) be an undirected graph. A set F ⊆ E of edges is called a feedback-edge set if every cycle of G has at least one edge in F. ...
1
vote
0answers
84 views

How to find minimum weighted vertex cover of a tree, and confused about a solution

Studying for my algorithms test by spamming Algorithm Design Manual exercises, but I'm stuck on this one. I know I have to keep score somehow. Let G = (V,E) be a tree with arbitrary weights ...
1
vote
1answer
93 views

Safe serial numbers generation

I want to generate a 6 digits serial number, ranged from A-Z (only uppercase allow), e.g. serial = "ABCDEF" the problem is, some letters are considered confusing to others letters/numbers, e.g. U ...
0
votes
0answers
32 views

Arduino ADC value and practices to store data to buffer

I'm writing Arduino application which has timer interrupt to acquire ADC value. Main loop has serial transmission procedure to send data from buffer. I'm not sure how to store data in buffer. Best ...
0
votes
0answers
42 views

Developing a “time scheduler” app [duplicate]

I need to develop an application to generate, given a set of preferences and constraints, a time schedule for employees. These tables can really get complex and they might need to take into account ...
0
votes
1answer
131 views

Is it possible to apply Master Theorem for finding the square and cube root

I was asked to calculate the running time of an algorithm which finds the square root and cube root of a given number. Is it possible to apply Master theorem with regards to this? First, I need to ...
0
votes
3answers
159 views

How would you go about compressing a list of integers that are non unique and retain the original order?

Let's start out with an example [1,1,1,5,3,1,1,2,78,2,3,1,1,...,1] As you can tell by the example, 1 is repeated a lot, but there will be outliers (like 78, and really anything that isn't 1). The ...
0
votes
0answers
16 views

A heuristic approach to Clique problem over undirected Graph

I'm trying to get all complete subgraph given a graph G. Needless to say it is an NP-problem complete: Clique_problem. I understand getting the full set is not possible in real time(since it'll take ...
3
votes
2answers
87 views

Process to generate hierarchical structure based on relational data?

I have a csv of employee ids, names, and a reference column with the id of their direct manager, say something like this emp_id, emp_name, mgr_id 1,The Boss,, 2,Manager Joe,1 3,Manager Sally,1 ...
3
votes
4answers
188 views

Algorithm for a UI showing X percentage sliders whose linked values always total 100%

A system I'm building includes a set of UI sliders (the number varies) each with a scale of 0-100. By slider I mean a UI where you grab an element and drag it up and down, like a volume control. They ...
0
votes
2answers
431 views

Kth Optimal path in a matrix

I had the following question I was trying to solve: You are given a n*n matrix. Every cell of the matrix contain some value (positive). You are currently at (0,0) and you have to go to right ...
1
vote
1answer
60 views

Algorithm to “de-rasterize” a voxel image of a polyhedron

Rasterizing a polygon in this question consists of creating an array of binary pixels that "represent" the polygon. The reverse of this process is easy to approximate in linear time to the perimeter ...
3
votes
1answer
48 views

How to diversify an optimal solution set?

If given a list of players, their salaries, and their projections, one can easily find the top 'n' projected teams (where a team is a combination of players), such that every team is under the salary ...
1
vote
1answer
67 views

Sorting list and changing same values to nearly the same

I have a list of doubles that need to be sorted and changed so that there are no two numbers that are the same (difference smaller then 0.05) and I need to do it fast. I don't care about preserving ...
-1
votes
3answers
140 views

Generate unique integer from two integers with algorithm

I am currently trying to come up with an algoritm which would take at least two numbers (say user IDs) and then come up with an unique number which is generated based on these two numbers. Each ...
1
vote
0answers
53 views

Calculating “instability score” for connection quality, programmatically

First of all, apologies if this is posted in the wrong site. I thought it is more suitable here than SO because the question is quite generic, more an algorithm question than a specific programming ...
2
votes
1answer
97 views

Data structures and algorithms for a directed rooted tree with inherited properties?

I need to represent a directed rooted tree in memory. The caveat is, that nodes have properties. And those properties are inherited (but not 100%) by the child nodes, recursively. What would be a ...
0
votes
0answers
84 views

Similar problem to word break

I have a list of strings say L and an array of words say A. I want to find a string from the list L that is a best match to a string created from the permutations of the words in the array. The ...
0
votes
0answers
58 views

How to improve A* Algorithm where each child node costs marginally different

I have an A* algorithm with a heuristic to best guide the best path. The problem is that each node can have up to 240 children and each subsequent child also... So doing a breadth first approach is ...
0
votes
1answer
50 views

Algorithm for tiling a surface with no adjacent tiles

I am looking for an algorithm that does as follows: Given a 2D grid of X,Y and a number of tiles T, places a tile in each cell of the grid such that the surrounding tiles are not the same. This ...
0
votes
1answer
82 views

Finding common subsets in a list of sets

Let say I have a list of sets, defined like this (3 sets in this example) : A = [1, 2, 3, 4, 5] B = [4, 5, 6, 7, 8] C = [1, 2, 3, 4, 5, 6, 7, 8] Total number of elements defined in sets : 18 I'd ...
0
votes
1answer
72 views

How to decide in which language to write an algorithm that iterates through large amounts of data? [closed]

I am attempting to implement an algorithm that takes in a massive array of data, and iterates through each element in this array. For each element, it will either create an new array and put the ...
1
vote
1answer
90 views

Check word density within a document

Here is the situation: I have a Document(d) and a set of keywords (Set<String> keywords). I like to check the density of each words from set keywords with d. I have few solution but not really ...
0
votes
3answers
168 views

How to do “image shifting” faster?

I have a grayscale matrix (implemented as a simple array) to be shown on a display: line 1: | a | b | c | line 2: | d | e | f | a-f are grayscale values. This pattern has to be shifted by a ...
16
votes
5answers
4k views

Algorithms: How do I sum O(n) and O(nlog(n)) together?

I have the follow algorithm which finds duplicates and removes them: public static int numDuplicatesB(int[] arr) { Sort.mergesort(arr); int numDups = 0; for (int i = 1; i < arr.length; ...
1
vote
1answer
77 views

saving connectivity information in a nodes/edges network

I want to implement the A* algorithm. I have a network with Nodes and Edges, both are classes. Now, I am unsure how to approach the connectivity information. Should a node know which edges depart ...
0
votes
0answers
22 views

selecting area in array and expanding it to surroundings

I'm currently solving an algorithmic problem, but english is not my native language and I'm running into the limits of my language abilities when searching for reasonable solution. The problem: I ...
0
votes
2answers
129 views

Algorithm for figuring out the enemy flag's location in Stratego

I am currently programming a Stratego game in JavaScript, simply because I wanted to learn to use JavaScript while spending some time to keep my programming skills up to par. (My current work ...
0
votes
1answer
56 views

Are there any known file dispensing algorithms?

I wish to know if there are any known algorithms for dispensing a list of files for a specified maximum directory size (disc size for example), while attempting to keep output directories size close ...
16
votes
1answer
509 views

3d Packing algorithm for item's shipping

I've received a task to build a shipping estimative that suggests the best accomodation of goods on as few boxes as possible: There is a finite set of known retangular box sizes There are many ...
2
votes
1answer
123 views

Find n nodes farthest away from each other

I'm looking for an algorithm that gives me the n nodes that are the farthest away from each other. Can this be accomplished relatively efficiently? To clarify my question: I think of the problem as ...
4
votes
1answer
141 views

Understanding Boyer-Moore Algorithm

Edit: I've found the original publication. It seems to me that the original does not have a l′(i). But I could be wrong because the definition of rpr(i) is so obscure to me. I'm not sure how it makes ...
0
votes
3answers
152 views

The right algorithm to get perfect combination

I am working on a self-study project but I cannot come up with a reliable answer. Here is the deal: I start with 500cm sticks. I have orders from customers who want smaller sticks. I am willing to ...
1
vote
1answer
44 views

Create a collection with “average points” of N items from a pool with items of various points

Let's say I have a question pool to generate exams out of it. Each question contains a difficulty from 1 (hard) to 99 (easy). The questions are available in a hash / array (adapt to your favorite ...
3
votes
1answer
370 views

Accuracy of “calculator algorithms”

I am building a library class that provides functionality for mathematical operations on BigDecimals (and a few on BigIntegers). Now, BigIntegers are quite easy to master and pleasant to use. ...
3
votes
1answer
63 views

Derive subset with sum between two values

I have a set S of size n whose members each have associated with them a number in the range 0.00 to 1.00 inclusive. I want to select a subset T of size m with this property: the average of the ...
2
votes
3answers
83 views

recalculation model for GUIs

I often come across this problem. Say to have a form with some controls: A B C = A + B D E = C * 2 ONLY IF D==TRUE F G = A - F The user fills A, then B. The system calculates C. The user fills D ...
-2
votes
1answer
136 views

Given a subset of numbers and subset of sums. Match the numbers to sums.(Harder than appears)

I found the question below on a forum board. I'm not sure what the most efficent solution is. I'm not sure this fits exact cover, and approaching it via exhaustive backtracking seems somewhat ...
3
votes
2answers
128 views

Algorithm for mapping users to a schedule based on time availability

I have a project where I must map employees to a schedule. The basic concept is: Company Opens between 08:30 and 17:00. Employee 1 can work from 08:30 to 12:00 then from 13:00 to 1700; Employee 2 ...