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
1answer
95 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 ...
1
vote
1answer
42 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
264 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
209 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 | ...
-3
votes
0answers
60 views

Algorithm to fill a canvas with triangles [on hold]

Given a canvas say, 1000 X 1000 unit. I would like to fill the canvas with triangles. The triangles can be of any type right angle, equilateral...etc. To avoid big chunks of triangles lets say all ...
0
votes
0answers
28 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
78 views

Mechanism behind QR code scanning of whatsapp webapp [on hold]

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
90 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
44 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 ...
1
vote
0answers
37 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
49 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
43 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
52 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
73 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
48 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
1answer
24 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
42 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
134 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
45 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
200 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
89 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
154 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
85 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
309 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 ...
12
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
52 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
79 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
24 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 ...
1
vote
1answer
47 views

Implementing CMA-ES

I am attempting to implement the CMA-ES optimization algorithm in my favorite language (using the example code here as a guideline), but I need help solving a problem I am having. To test the ...
-2
votes
3answers
116 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
166 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
47 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
161 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 ...