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
2answers
103 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 ...
5
votes
1answer
121 views

Algorithm to generate all sets of m points in n x n x n cubic lattice which are unique under symmetry

I am implementing an algorithm which is going to be quite computationally complex, and want to try to make sure I'm not doing unnecessary work. There is an n x n x n cubic lattice, e.g. if n=2 this ...
-3
votes
0answers
30 views

New methodology for compression: Non-universal tree, with pyramidic styling

The program below works efficiently. It can do the 'enwik8' test run in 13 minutes on a 2.6ghz 4gig, machine. It compresses to 10% of any original file over 50 bytes. There are no consequences to it ...
1
vote
0answers
33 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 ...
0
votes
2answers
170 views

How to implement backtracking to check if all fields have been traversed

I have been learning algorithms and trying to solve problems and now I have the following problem: In a 4x4 matrix, and it contains fields with height. There is a start field with given height also ...
0
votes
0answers
29 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 ...
0
votes
0answers
25 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" ...
4
votes
0answers
50 views

Generating sort keys when reordering items

We have a number of items which the end user will be able to organize into a desired order. The set of items is unordered, but each item contains a sort key which can be modified. We're looking for ...
1
vote
1answer
72 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 ...
0
votes
2answers
269 views

How to approach hours forecasting

I need to forecast budgeted hours for 2 departments to help them schedule staff as currently the best they can do is just wing it. When we receive a job proposal I'll have the person submitting the ...
6
votes
3answers
215 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
31 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
votes
0answers
85 views

Mechanism behind QR code scanning of whatsapp webapp [closed]

I could not find any answers related to the working mechanism of qr code scanning used on whatsapp web-app. How does the authentication happen when the phone (any smartphone running whatsapp) scans ...
1
vote
1answer
92 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
48 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 ...
0
votes
0answers
27 views

I am trying to make a function with that returns true/false if an element is in the vector but I am getting an error? [migrated]

I am trying to implement a function in C++ using STL which takes an object and a vector of objects and return true if the vector contains the object else false. Below is the implementation of the ...
2
votes
0answers
43 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
54 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
45 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 ...
0
votes
0answers
55 views

What type/class of algorithms should be run on a gpu? [closed]

Is there a class of defined algorithms that run quicker on a gpu than a cpu? IE: divide and conquer, greedy, multi-threaded algorithms, etc. For algorithms that do not run faster on a gpu, but can ...
-1
votes
2answers
55 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
186 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
75 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
52 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 ...
-1
votes
0answers
27 views

RSS feed topic categorization

I'm trying to make my own news feed from CNN's RSS feed (among a dozen other news sources). However, I've come across a problem that is actually quite complex, at least that's what I think. One of ...
2
votes
1answer
81 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
43 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
136 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
192 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 ...
-3
votes
0answers
24 views

Making forest from shuffled nodes [closed]

I have shuffled nodes of a few trees. How to make trees from list of nodes? Each node has own key(hash) and key of parent. I we meet first parent and next child - we can use unordered map to find ...
0
votes
1answer
46 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
201 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 ...
0
votes
1answer
93 views

Finding all possible paths in a matrix [closed]

The problem I am having is finding the number of possible paths in a matrix, with a start point on the right above a certain which is given and end point on the right below the same point. The ...
3
votes
1answer
156 views

Dynamic Programming - Largest arrangement of bookcases

I'm trying to solve a problem, so I'm not looking for code, but for similar algorithms so I can solve it myself. I am given n bookcases each with a size amount of books inside. I am to move some of ...
0
votes
2answers
107 views

Extract significant locations from GPS readings

I'm writing an app that continuously monitors user location 24 hours a day using a mobile phone with readings every 5-30 mins (about 50-300 readings a day). How do I cluster readings and extract user ...
0
votes
1answer
235 views

What is a lattice parser?

My friend asked me for help with his task: "Redeem a lattice parser with any programming language" - the problem is that he can't clearly explain me how the lattice parser should work. I've tried to ...
1
vote
1answer
86 views

How to “de-dupe” similar lines (detected using the Hough Transform as rho/theta pairs)

I'm trying to identify an object (a cube) in a set of photos. Using Canny/Sobel/Hough I've managed to get the photo down to a set of lines that are pretty accurate; however if I plot these lines on my ...
2
votes
1answer
488 views

Grouping algorithm

We've developed an algorithm that depending on the check-in time of some workers and their living place, calculates the way to group them into some vehicles and the route which must be followed by the ...
5
votes
2answers
311 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
34 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
157 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 ...
2
votes
1answer
52 views

Finding unique tuples list of options

I'm having a bit of hard time finding a solution to the following problem. I need to find tuples of (a-c, 0-2) such that if I make a choice with one letter and a key I can't select it again. Example: ...
-1
votes
0answers
54 views

How to decompose strings into a list of its spelling in an efficent way?

I have the problem where I'm taking as input a string, for example "table python desk" and I wish to decompose the string in terms of its spelling. So I want to output "t ta tab tabl table p py pyt ...
3
votes
2answers
176 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 ...
6
votes
1answer
80 views

Data structure for determining intersection between line and polygon in 3D

I have a collection of non-self-overlapping simple polygons P. In actuality, they are 2D triangles in 3D-space. I'm looking for a data structure which, given a line L, has a relatively fast lookup ...
-2
votes
0answers
25 views

UITableView addition SWIFT

I have a UITableView that lists items. Each item has a quantity and a price. The information is saved in the CoreData and I need to get the total of all items I managed to get the total only for each ...