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)

2
votes
2answers
213 views

What kind of transform is this?

I have a function that linearly "remaps" a value from a given interval to an other interval? The function remaps a value from a given interval [oldMin, oldMax] to another interval [newMin, newMax] ...
15
votes
2answers
777 views

Algorithm for fast tag search

The problem is the following. There's a set of simple entities E, each one having a set of tags T attached. Each entity might have an arbitrary number of tags. Total number of entities is near 100 ...
2
votes
2answers
247 views

Graph traversal and filtering in indoor navigation and path finding

Which of the following options take less processing time/is less expensive in a graph traversal algorithm for a (indoor)navigation system? a) To produce all possible paths between start and ...
0
votes
1answer
135 views

fill containers with blocks of different sizes to have containers of “similar” sizes [closed]

I have a sorted list of blocks L that I want to put in 4 containers C, the containers have a size limit S. I want to have similar containers height, by similar I mean the size variance should be as ...
0
votes
1answer
960 views

Guidance on Excel VBA resource scheduling algorithm?

This was posted originally at StackOverflow though suggested to post here instead. I am looking to create an Excel VBA solution that will create a rota/schedule allocating staff to service users ...
2
votes
4answers
368 views

Is there any sorting algorithm which is not inherently sequential and is task distributable?

After googling for a couple hours, I came to a conclusion that all sorting algorithms are inherently sequential which can be data distributed but not task distributable. Is there any algorithm which ...
6
votes
3answers
318 views

Unit (regression) testing scientific algorithms given floating point behavior

I have been working on a project and running into a very difficult problem. The problem can be stated simply as how to unit-test numerical algorithms. However if you just took this simple statement ...
2
votes
1answer
155 views

Cohen–Sutherland algorithm

I was reading Cohen–Sutherland algorithm on Wikipedia and I am confused in these two parts, int ComputeOutCode(double x, double y) { ... if (x < xmin) code |= LEFT; else if (x ...
7
votes
3answers
3k views

Why Big Data Needs To Be Functional?

I started working on a new project lately related to Big Data for my internship. My managers recommended to start learning functional programming (They highly recommended Scala). I had a humbled ...
0
votes
2answers
133 views

finding patterns into logs

I am trying to put together a way to figure out if incidents occurred based on log content. Typically, on log (or db table) would contain a list of transactions composed as follow: {Timestamp} ...
5
votes
4answers
395 views

How are algorithms developed? [closed]

I'm impressed with the efficiency of some algorithms and I noticed the way the problem is solved can be and/or appear really unintuitive. It may sound dumb, but I would like to know: How do the ...
2
votes
3answers
1k views

Sorting an array of numbers with decimal places

Suppose I have an array of float values in the following format: { 1.34, 1.15, 1.1, 1.2, 1.26, 1.10, 1.20, 1.17 } Suppose they have been provided by user input (or some other mechanism), where the ...
0
votes
0answers
122 views

How to algorithmically add notes to an existing midi file relative to positions of existing notes in python

I have a midi file that I'd like to algorithmically add notes to relative to other notes that already exist in the midi file using python, or if it's easier using a different language I'm open to that ...
1
vote
1answer
501 views

When interviewing programmers, are algorithm problem solving skills relevant for a job were solving such algoritm problems isn't normally needed? [closed]

Software created for some business domains don't require heavy use of algorithm problem solving skills on the job from the programmers working there. For example, a JEE developer might most of the ...
0
votes
3answers
747 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
130 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
1k 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
111 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 ...
12
votes
4answers
1k 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 ...
2
votes
0answers
186 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
803 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
66 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
257 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
209 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
140 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
123 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 ...
22
votes
3answers
3k 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
109 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
291 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 ...
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 ...
0
votes
1answer
52 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
230 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
329 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 ...
13
votes
3answers
598 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
408 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
472 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
97 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
2answers
944 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
345 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
391 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
87 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
328 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
686 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
93 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
1k 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
131 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. ...
9
votes
1answer
215 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
323 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
213 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 ...