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
3answers
327 views

Algorithm for recursive evaluation of postfix expressions

I'm reading Sedgewick's book on algorithms in C and I'm looking for an algorithm to evaluate postfix expressions (addition and multiplication only) without using a stack. I tried to implement one but ...
1
vote
1answer
98 views

Search Substring in String collection

I have a big collection of strings a[1], …, a[N] where N is about several millions. I am provided a string m and I need to iterate over all the strings a[i] that contain m. In other words, I need to ...
3
votes
1answer
491 views

Database design/relationship for threading messages

What's the database design or business logic for creating an app for messaging between users? I am having difficulties with choosing how to approach the relationship between each Conversation of User ...
0
votes
1answer
88 views

Better way to create samples

I've done this piece of code for creating bernulli samples, but I think that it is a so heavy algorithm because every time I call this recursive function I create a new vector that is passed to it. Is ...
11
votes
4answers
722 views

How do you identify a problem as being suitable for dynamic programming?

I have been reading up on dynamic programming lately. Would like to hear from someone who started from scratch and now is pretty good at identifying and solving DP problems. I am struggling in ...
1
vote
0answers
159 views

Help/suggestions for Parallel assembly line scheduling (Dynamic programming)

I am working on a problem similar to the assembly line scheduling by dynamic programming.The issue is that unlike the classic problem where we have predefined stations now I only have information ...
2
votes
3answers
193 views

Evaluate all pair combinations in an array for a condition in n log n time complexity

Task - Consider an array of n elements. Count the number of pairs that satisfy condition X (sum of the two elements < an arbitrary number, k) . The basic approach I could think of would be O(n^2), ...
0
votes
0answers
50 views

Optimal group room division algorithm with weights

I hope someone can help me with this, as I'm thoroughly stuck. I'm working with a group at my university, on a first semester research report that should end up as a finished program, solving the ...
1
vote
2answers
149 views

An algorithm for a synchronization

I want to make a synchronization. What's the algorithm for it in a nutshell? 1) A client reads a local data and sends them to a server afterwards. The server compares them with its actual data, ...
2
votes
3answers
176 views

Algorithm to calculate estimated future usage of a defined value

I am looking for the name of a computer algorithm. I'm fairly sure that one should exist which will help me, but I can't for the life of me figure out what to search for. If you have implementations ...
1
vote
1answer
114 views

How to calculate the worst-case runtime of this search-algorithm

I've written a special indexOf function for a list of unsorted unique values. I can search for one or multiple (unsorted) values, passed as array/list, and the function will return me an array/list ...
2
votes
1answer
113 views

Comparing strings against a pool of words

I am creating an app where the user enters 8 characters. After he enters the string I have to see if it is an eight letter word. If not, check if contains a seven letter word etc. I am checking ...
21
votes
3answers
1k views

What are the data structures behind a spreadsheet?

I would like to understand how a spreadsheet (a group of named or otherwise identified cells containing values or formulas referencing other cells) is solved. I have tried looking at existing ...
4
votes
3answers
93 views

Approach to algorithm for assignment of resources

We have a requirement to be able to match people with locations based on availability and certain conditions. Let's say I have a group of people each with 3 types of things they may need to park. A ...
0
votes
1answer
264 views

Can someone help me in creating a dynamic programming solution to this problem?

I have some function names which are assigned to some nodes. I have to decide which functions to move to other nodes to increase speed. Why do I have to move the functions to other nodes? If ...
0
votes
1answer
74 views

Deriving an algorithm from its neural network representation [closed]

I am not sure if this question is silly or not, or even nonsensical, but can a neural network be converted to a traditional algorithmic representation ? For eg. the NN for a pattern recognition ...
2
votes
1answer
59 views

computing whether service level times are met

For a ticket reporting tool, I want to compute whether certain service level times (slt) are met. That is (a bit simplified): Was the timespan between opening and closing of the ticket within a ...
2
votes
0answers
200 views

How to use simulated annealing to find lotto coverings?

I read from the Internet that simulated annealing is used to find some lotto design. How to do that? I mean, I tried to use that but I don't see how we can measure what is the best lotto row to add to ...
0
votes
1answer
44 views

Layered Manufacturing Contour Generation

I am currently working on software for layered manufacturing (3D printing), and have come to a point where I no longer know what to do. I am at the stage where I must take a bunch of lines, and order ...
1
vote
2answers
143 views

Making an algorithm more efficient

I have a question about the efficiency of an algorithm: You have a list of x,y points Now I want to get all the points that are up to 5 units away from a reference x,y point How do you calculate it ...
2
votes
1answer
174 views

Shuffling algorithm with no “self-mapping”?

To randomly shuffle an array, with no bias towards any particular permutation, there is the Knuth Fischer-Yeats algorithm. In Python: #!/usr/bin/env python import sys from random import randrange ...
12
votes
4answers
521 views

Searching integer sequences

I have a fairly complex search problem that I've managed to reduce to the following description. I've been googling but haven't been able to find an algorithm that seems to fit my problem cleanly. In ...
3
votes
6answers
375 views

Which is the most practical way to add functionality to this piece of code?

I'm writing an open source library which handles hexagonal grids. It mainly revolves around the HexagonalGrid and the Hexagon class. There is a HexagonalGridBuilder class which builds the grid which ...
7
votes
4answers
305 views

Fastest way to check if two square 2D arrays are rotationally and reflectively distinct

The best idea I have so far is to rotate first array by {0, 90, 180, 270} degrees and reflect it horizontally or/and vertically. We basically get 16 variations [1] of first array and compare them with ...
1
vote
1answer
74 views

Matching users based on a series of questions

I'm trying to figure out a way to match users based on specific personality traits. Each trait will have its own category. I figure in my user table I'll add a column for each category: id name ...
3
votes
1answer
539 views

Reverse horizontal and vertical for a HTML table

There is a two-dimensional array describing a HTML table. Each element of the array consists of: the cell content rowspan colspan Every row of this two dimensional array corresponds to <td> ...
2
votes
1answer
151 views

Approach to Authenticate Clients to TCP Server

I'm writing a Server/Client application where clients will connect to the server. What I want to do, is make sure that the client connecting to the server is actually using my protocol and I can ...
2
votes
4answers
244 views

Looking for monotonically increasing (integer) hash function

I'm looking for a HashFunction(X,Y: Integer): Integer that is monotonically increasing on X, then Y. So: HashFunction(x1,y1) > HashFunction(x2,y2) if x1>x2 HashFunction(x,y1) > HashFunction(x,y2) if ...
0
votes
0answers
64 views

Permission Management Algorithm

I have 3 levels of permission to see the product: Brand -> Allow/Deny Category -> Allow/Deny Product -> Allow/Deny For example, product A has: Category: Allow Product: Deny => product A cannot ...
0
votes
3answers
233 views

How to create single integer index value based on two integers where first is unlimited?

I have table data containing an integer value X ranging from 1.... unknown, and an integer value Y ranging from 1..9 The data need to be presented in order 'X then Y'. For one visual component I can ...
-1
votes
2answers
207 views

Accuracy in calculating distance from Android Device using double integral? [closed]

Using TYPE_LINEAR_ACCELERATION suppose I found out that the device is moving at 4 m/s². a(t)=s"(t)=+4 v(t)=∫4tdt s(t)=2/3t³ s(3)=18m How much accurate it would be?
2
votes
1answer
84 views

Finding the order of a set's elements

A little rephrased, in the form of a game, real-life problem: Suppose there is a set of elements {1, 2, ..., n}. Player A has chosen a single permutation of this set. Player B wants to find out the ...
-1
votes
3answers
391 views

Find all lines segments intersections

I have a collection of lines segments, represented by an array. Ex: [3,7,13,6,9] is 4 line segments: [(3,7)(7,13)] , [(7,13)(13,6)] , [(13,6)(6,9)] , ([6,9)(9,3)] I want to find all the lines ...
-1
votes
5answers
1k views

Reverse subarray of an array with O(1)

I have an idea how to implement sub array reverse with O(1), not including precalculation such as reading the input. I will have many reverse operations, and I can't use the trivial solution of O(N). ...
2
votes
0answers
92 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. ...
-1
votes
3answers
296 views

Approximately how much is solid and broad knowledge of data structures and algorithms worth in the employment market? [closed]

I'm wondering how much I can boost my salary if I was to gain a strong and broad understanding of data structures and algorithms. I know the real basis but there are so many data-structures out there ...
8
votes
1answer
182 views

“Bad apple” algorithm, or process crashes shared sandbox

I'm looking for an algorithm to handle the following problem, which I'm (for now) calling the "bad apple" algorithm. The problem I've got N processes running in M sandboxes, where N >> M. It's ...
1
vote
1answer
202 views

Operating systems theory — using minimum number of semaphores

This situation is prone to deadlock of processes in an operating system and I'd like to solve it with the minimum of semaphores. Basically there are three cooperating processes that all read data ...
2
votes
2answers
124 views

Effective and simple matching for 2 unequal small-scale point sets

I need to match two sets of 3D points, however the number of points in each set can be different. It seems that most algorithms are designed to align images and trimmed to work with hundreds of ...
0
votes
2answers
135 views

moore's law and quadratic algorithm

I was going thru a video (from coursera - by sedgewick) in which he argues that you cannot sustain Moore's law using a quadratic algorithm.He elaborates like this In year 197* you build a computer of ...
1
vote
2answers
954 views

Why does a proportional controller have a steady state error?

I've read about feedback loops, how much this steady state error is for a given gain and what to do to remove this steady state error (add integral and/or derivative gains to the controller), but I ...
0
votes
1answer
88 views

Calculating WPM given a variable stream of input

I'm creating an application that sits in the background and records all key presses (currently this is done and working; an event is fired every keydown/keyup). I want to offer a feature for the user ...
3
votes
1answer
67 views

An extensible logging architecture for Android?

The end goal is to have a variety of data sets that can all be graphically plotted against eachother. All data should correspond to a date, so that when plotted against each other, they show the ...
1
vote
1answer
158 views

Custom animation iOS

I have seen animation, and i can't figure out how to do something like in this video(youtube). I want to discuss how it's made. I don't think that they're using sprites. I have one idea how to do ...
6
votes
2answers
380 views

Finding the lowest average Hamming distance when the order of the strings matter

I have a sequence of binary strings that I want to find a match for among a set of longer sequences of binary strings. A match means that the compared sequence gives the lowest average Hamming ...
7
votes
1answer
456 views

Name of the Countdown Numbers round problem - and algorithmic solutions?

For the non-Brits in the audience, there's a segment of a daytime game-show where contestants have a set of 6 numbers and a randomly generated target number. They have to reach the target number using ...
2
votes
3answers
164 views

Algorithm to infer tag hierarchy

I'm looking for an algorithm to infer a hierarchy from a set of tagged items. E.g. if the following items have the tags: 1 a 2 a,b 3 a,c 4 a,c,e 5 a,b 6 a,c 7 d 8 d,f Then I can construct an ...
2
votes
1answer
132 views

content fingerprint algorithm

I have a database containing just simple URLs. It is as simple as it sounds for now and URL can link to a website or a document(i.e. anything parseable to text). Now I have a simple code which ...
2
votes
1answer
152 views

Algorithm to update priority ordered list where changing priority of an item is expensive

I am working against an API where I can add and update items in a list that is ordered by a priority field I can set (which need not be contiguous but must be a positive integer). Updating a list ...
-2
votes
1answer
4k views

Algorithm to create an TicTacToe game AI [closed]

What are the algorithms I could use to create an AI for the game TicTacToe. I have already used Alpha–beta pruning and Predictive modelling. What the other good Algorithms I can use to create this AI. ...