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)

5
votes
6answers
454 views

Algorithm for determining transactions among weekly data series?

I'm trying to develop a small reporting tool (with sqlite backend). I can best describe this tool as a "transaction" ledger. What I'm trying to do is keep track of "transactions" from weekly data ...
0
votes
1answer
57 views

Mapping match-up combinations into an integer

First of all, I want to say I wasn't sure if I should post this here or in math.stackexchange but I think the question is too programming-related to belong to the latter community. Definetly not a SO ...
10
votes
2answers
6k views

Shortest Common Superstring: find shortest string that contains all given string fragments

Given some string fragments, I would like to find the shortest possible single string ("output string") that contains all the fragments. Fragments can overlap each other in the output string. Example:...
1
vote
1answer
71 views

How to improve timeout value dynamically?

I'm working on an application where I want to keep a timeout value computed dynamically using a moving average of say 100 previous response times for service A. This value + some buffer (~3 seconds) ...
2
votes
1answer
49 views

finding optimal token definitions for compression

I have a collection of strings which have a lot of common substrings, and I'm trying to find a good way to define tokens to compress them. For instance, if my strings are: s1 = "String" s2 = "Bool" ...
0
votes
0answers
31 views

Optimal Simplification of Transposition Products

I am looking to take a product of a large number of transpositions, and boil it down to a smaller number of products. I have the following code, and would like some input on efficient ways to boil ...
1
vote
2answers
419 views

Generating combinations algorithmically

Suppose I have an n-high pyramid of numbers like: 1 5 8 2 5 4 8 9 3 1 2 8 3 7 2 How can I algorithmically walk through every possible path from the top of the pyramid to the bottom? To ...
2
votes
1answer
55 views

Pre-computation strategies when solving multiple linear equations with the same matrix?

Often in modeling, data processing, and optimization; the intensive portions of the code can often reduce to solving a lot of linear equations. e.g. solve for x1 in A x1 = b1 solve for x2 in A x2 =...
1
vote
1answer
161 views

Finite Element Shader

I am working on a geometric wrapper for a space jet exhaust impingement solver. A key part of the solution is determining what the jet can "see" and therefore hit. My model is grouped with nodes or ...
-2
votes
0answers
28 views

Word association with domain specific metadata

Let say , I have n number of domain and for each domain, i have separate text corpus. [ means text corpus specific to different market places[US/UK/JP...]] Now same word can appear in many different ...
1
vote
1answer
94 views

What Graph Theory approaches or algorithms are useful for designing a House?

I have a set of data about a family, and I want the software to find a house design that fits the data (which includes stuff like preferences and whether they want a pool. The current way I am going ...
0
votes
0answers
85 views

Planning dinner seating, having each person sit with as many other people as possible, changing tables between each course

My project is as follows: I am making a program for planning dinner seating that will take a number of courses, a number of tables, and a list of people. The goal is to have each person sit with as ...
1
vote
2answers
343 views

Euclidean Space Fully Connected Nondirectional Graph: Shortest Path to all nodes

So this may be a question that is born of my inability to properly express my intentions to Google. In a fully connected non-directional graph such that any three points can be properly represented ...
1
vote
2answers
129 views

Algorithm to create all unique sets of the alphabet using arbitrary group sizes

I'm looking for an algorithm to help me out with a combination of combinations problem. I have generated two lists of combinations of letters: (26 choose 6) & (26 choose 5) My goal is to be able ...
0
votes
1answer
86 views

Brute force improvement over generating permutations?

I am trying to improve a brute force algorithm for letters of the English alphabet [a-z][A-Z] and numbers [0-9]. The length of the generated permutations should be 8. So far, I've built a simple brute ...
0
votes
1answer
56 views

Finding longest subsequence with sum less than a fixed number

I was trying to solve Problem 279-B. To find the maximum length of a continuous subarray in an array that is less than a given integer. e.g. [3,1,2,1] and 5 -> 3(1,2,1) ; [2,2,3] and 3 -> 1 I ...
4
votes
2answers
112 views

Find minimum number of steps to a goal without estimator for how close intermediate steps are to the goal

I've been trying to find a good way of solving the following problem, but I'm not sure how to even frame it. I think there might be relatively well-known solutions I'm not familiar with, since I don't ...
1
vote
0answers
50 views

One producer and one consumer vs inconsistent shared resource state

I was reading about implementation of producer-consumer problem with one producer and one consumer. Looking at this paragraph I see the implementation where shared resource access is not synchronized ...
-1
votes
0answers
46 views

Algorithm for Multiple Choice Test Prep App

I'm working on app that helps students prepare for a specific exam. I have a database of 1000 questions, question categories, multiple choice options, hints and correct answers. Today, the app simply ...
1
vote
1answer
82 views

Fast straight-line-integrals over a discrete grid

I have a grid that represents a sampling of a continuous function in a 2 dimensional space. I'm looking for a (preferably fast) algorithm that can calculate the discrete line integral along a straight-...
6
votes
3answers
217 views

Fuzzy algorithm for grouping data

I have data that indicates which topics each student has got right/wrong in an assessment.: | Student | Topic 1 | Topic 2 | Topic 3 | Topic 4 | Topic 5 | ... (perhaps 30 topics) | 1 | T | ...
0
votes
0answers
34 views

Algorithms for Distribution and Logistics problem

I am looking for a way to express the following logistics/distribution problem as an equation that could be solved with a solver (optimization). Or if there is an known algorithm that would most fit ...
1
vote
1answer
105 views

Understanding recursive solution of some algorithm

Most of the time we need to understand someone else' code for example I am studying Graph Algorithms from Sedgewick's online resources, the particular code example is taken from cycle detection ...
1
vote
1answer
51 views

Generate a string generator (constant associative array)

There is a finite set of unique strings and a limited key space. One key corresponds to one string value and a function must exist to perform the resolution. There is no need to support other ...
2
votes
0answers
45 views

Most efficient way of allocating participants to conference tracks

I am redesigning a system by which conference participants can choose which track they want to attend. Participants express their track preferences arranging them in order and submitting them at a ...
0
votes
1answer
59 views

How to traverse “linked list” like structure with parallel nodes

I am working on a signal processing project that allows for parallel processing on data streams as well as inputs and outputs to and from multiple endpoints. The signal chain is broken down into "...
1
vote
1answer
48 views

Finding longest ambiguous words with a given set of letters

I have been playing hangman with my friend over an app for a while now, and we have a gentlemen's understanding between us that we are both "cheating" by using online software both to solve the given ...
13
votes
3answers
1k views

What is O(…) and how do I calculate it?

Help! I have a question where I need to analyze the Big-O of an algorithm or some code. I am unsure exactly what Big-O is or how it relates to Big-Theta or other means of analyzing an algorithm's ...
-1
votes
2answers
56 views

Find best layout to reduce use of space or material

Example case: You have a truck, that can hold 2.8m by 3.2m by 16m of storage capacity. You you get a bunch of physical objects you want to store in that truck. These objects are not always cubic, but ...
1
vote
5answers
192 views

Is “a general process for solving a category of problems” the right definition of an algorithm?

I am reading Think Python: How to Think Like a Computer Scientist, the author says that an algorithm is: A general process for solving a category of problems. But I don't know if that a right ...
0
votes
1answer
77 views

Trying to find time complexity of modulus algorithm

I can't quite figure out the time complexity of this algorithm I've written for finding the modulo. I've added it here in psuedocode. Modulo(int x, int n) // x is the dividend, n is the divisor e ...
1
vote
2answers
61 views

Conditionally show questions based on previous answers in a database driven survey

I'm trying to design survey-type application that uses user responses to determine what the next question should be. For simplicity's sake, question types can be either combo boxes (they have a set ...
1
vote
2answers
35 views

Listing search/query results from 30+ web services efficiently and orderly

We have a system that currently has approx 25 customers (will never expand from this) that each have a public facing web service which allows each other to query each others internal application ...
2
votes
1answer
85 views

Optimizing the exponential smoothing of a big array

I have a large set of values (let's say 1M entries) where I need to apply an exponential smoothing algorithm, but only incrementing one value at a time (all others decay to zero). The trivial ...
0
votes
1answer
47 views

Algorithm for matrix positioning

Lets say I have an original mxn matrix like this: 1 2 3 4 5 6 7 8 For the purpose of my program, I then concatenate the rows into this new one dimensional matrix: 1 2 3 4 5 6 7 8 I know the mxn ...
1
vote
2answers
148 views

How to calculate business days difference without a lookup table

How can I calculate the number of buisness days (M-F, agnostic of Holidays) between two dates without a look up table? There has to be some sort of algorithm based on the number of all days and the ...
3
votes
1answer
198 views

Swapping variable values without creating a new one

Recently, I was faced with a question that asked me to swap variable values without creating an extra variable. i.e. A = 10, B = 20. How store 20 to A and 10 to B? The solution is: A = A + B #...
0
votes
1answer
50 views

The maximum number of induced cycle in a simple directed graph

Given a simple directed graph G=(V,E) an induced cycle is a cycle where no two vertices of the cycle have an edge that is not in the cycle. (Chordless cycles are induced cycles with at lease 4 ...
4
votes
1answer
211 views

Are there multiple Hamiltonian Paths on a Graph?

Can anyone suggest an algorithm for this problem. Given an undirected unweighted cyclic graph, and a given start and end node in that graph, I'd like to determine if there is exactly one valid path ...
5
votes
2answers
321 views

Automatic Appointment Conflict Resolution

I'm trying to figure out an algorithm for resolving appointment times. I currently have a naive algorithm that pushes down conflicting appointments repeatedly, until there are no more appointments. #...
0
votes
0answers
41 views

Dynamic programming vs branch-and-bound for the knapsack problem

I have to implement a program that solves the 0-1 knapsack problem, where the weights and values of all items are nonnegative integers. We went over two methods in class: dynamic algorithms (...
1
vote
1answer
165 views

What does Rob Pike mean by fancy algorithms?

In "Rob Pike's 5 Rules of Programming", he states, "Fancy algorithms are slow when n is small, and n is usually small. Fancy algorithms have big constants. " and as the next rule he states that "Fancy ...
5
votes
8answers
2k views

How meaningful is the Big-O time complexity of an algorithm?

Programmers often talk about the time complexity of an algorithm, e.g. O(log n) or O(n^2). Time complexity classifications are made as the input size goes to infinity, but ironically infinite input ...
13
votes
4answers
2k views

Pattern for algorithm that outputs an explanation of how it gets to a solution when needed

The following scenario happened to me several times. I programmed a algorithm that solves a certain problem. It works fine and finds the correct solutions. Now, I want to have an option to tell the ...
3
votes
2answers
180 views

How to match up courses with requirements

I have a list of courses taken by a student, as well as several requirements. Each requirement consists of a list of courses that fulfill that requirement and the number of such courses that must be ...
-2
votes
3answers
132 views

How to create an algorithm for a raffle, where each raffle guarantees a winning ticket?

I am looking for an algorithm to create a raffle, where each participant is assigned a ticket with a random series of numbers. Each raffle hast N participants, and there should exist same amount of ...
2
votes
1answer
176 views

Getting started with machine learning a zero sum game?

I have a simple zero sum, discrete, deterministic, complete information board game. I want to machine learn an evaluation function for an AI agent. Suppose each board state has ~20 identifiable ...
0
votes
1answer
52 views

Creating hyperlinks in documents and messages

In Sweden the abbreviation "t.ex." means "for example" ("till exempel") and it is extremely common. Every time I write that t.ex. in an email or in a text message it gets marked up as a clickable ...
2
votes
2answers
164 views

Poker split / side pots

I am writing a poker application and trying to figure out how to deal with split pots and side pots There are four rounds of betting and each round of betting can have multiple orbits Can only ...
1
vote
0answers
58 views

Resource Allocation Algorithm

I have a question about assigning values to nodes laid out in a physical space: There is a set of N fixed nodes spread out throughout a certain 2 dimensional region that need to be assigned a value ...