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.
-5
votes
0answers
39 views
Describe a Θ(n) strategy for sorting the records? [on hold]
Records consists of three fields: name, gender, and year (1st, 2nd, 3rd). The records must be sorted by year, then by gender. The records do not have to be sorted by the name field. Describe a Θ(n) ...
-2
votes
1answer
108 views
How to find complexity of T(n) = 8T(n/2)+n^2.93(log n)^93?
I believe we have to use a variant of master theorem...can someone suggest me how to find complexity of such equation which doesn't directly fit into Masters theorem.
0
votes
1answer
35 views
Partition edges into areas
If I have a series of edges that branch and curve, such as in a road network, is there an algorithm that will identify the areas (defined by sequence of geographic points) defined between those lines?
...
3
votes
1answer
97 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
0answers
54 views
How do I determine the image direction
if I have two pictures, say A and B respectively, A was taken at time t1 and after that the camera was moved slightly to the left and then B was taken at time t2.
Is there any algorithm that I can ...
-6
votes
0answers
47 views
Develop an algorithm and programming in PASCAL [closed]
In preparation for the General Elections the Elections Authority must undertake the printing of voting slips for the various electoral districts. Each voting slip must contain the voter's full name ...
3
votes
0answers
36 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 ...
-4
votes
0answers
34 views
Surface-fit algorithm for logarithmic function with 2 independent variables
In my application I need to find the best-fit surface for a sample of data points with n ranging from dozens to a few hundred. The function that I need to fit is:
f(x,y) = C0 - 20log( sqrt[(C1 - x)2 ...
1
vote
1answer
91 views
Design for autocompleting words in search engine?
I'm trying to implement an autocomplete feature for a search engine. I have a database of words(stemmed) that occur in the documents that I have for users to search.
What I am thinking of doing is:
...
1
vote
2answers
79 views
Algorithm for finding all empty tiles in rectangular grid?
I have a rectangular grid of square tiles, some of which are blocked/filled. I start at a random tile inside the grid with the blocked tiles, randomly placed. I can turn in 90° steps and check whether ...
1
vote
0answers
47 views
Restricted randomization of a binary vector
Suppose I have a binary vector of sample size N with each of the two possible values (e.g., 0 and 1 occurring equally often).
For example, if N=10, the binary vector is: 0 0 0 0 0 1 1 1 1 1
Suppose ...
1
vote
1answer
43 views
Keeping track of the number of nodes in the subtree in black and red trees
I was wondering, if I have a black and red tree and I want to keep track of the number of nodes in the subtree, what is the most effective way to do so?
I mean how do I work with these values while ...
6
votes
1answer
132 views
Finding all possible ways of inserting a pattern into a string
I've been thinking about this problem for a while, and I can only find a recursive solution but I'm feeling that there is a dynamic programming way to do it, I just can't figure it out. Is this a ...
-3
votes
0answers
49 views
algorithm for generating recommendations
We have a user with some data of events they have attended, most importantly lineups with artists.
Then, we have the artist with history of lineups that they have been on. If they shared a bill with ...
2
votes
1answer
92 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 ...
1
vote
0answers
38 views
List all intervals made by inherited array of intervals
i have a grading system which works like this:
You have a array of intervals with grades:
[9, Inf) => A; [7, 9) => B; ... (-Inf, 1) => F
But you can create also inherited grading system ...
3
votes
1answer
110 views
Neighbourhood points (2d) [closed]
I have a 2d coordinates system with some points on it, like this one:
Now I am looking for an algorithm (or just some approach) to find neighboured points.
So, if you have the coordinates of one ...
1
vote
1answer
70 views
Determine what to draw based on neighbour tiles?
I have a tilemap and I want to add walls to it. I painted 16 images, one for each possible combination. For example:
A lone wall tile would get a image that has walls around.
A corner would get ...
0
votes
0answers
69 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 ...
3
votes
1answer
122 views
How to find the closest vector to a given vector?
Let's say I have several points / vectors (in 2D to keep it simple, but could be of any dimension)
[x1, y1]
[x2, y2]
[x3, y3]
....
[xn, yn]
If I pick some point [x', y'], how do I ...
2
votes
2answers
100 views
Generate pips on a die based on value
Is there an algorithm to generate the pips on a die or domino?
I know that there is usually an odd number of columns and even number of rows (unless the max number of pips is not a perfect root).
...
-1
votes
0answers
31 views
Algorithm to find minimum spanning tree in graph with weights in {1,2,3}
I have recently been doing some research into Prims/Kruskals algorithms for finding minimum spanning trees in graphs, and I am interested in the following problem:
Let G be an undirected graph on ...
4
votes
2answers
470 views
Why do textbooks use pseudocode rather than real languages?
In colleges and in algorithm textbooks, it is quite common for the teacher and author to explain control flow in pseudo-code. With the advent of more expressive languages like Python and Haskell among ...
1
vote
2answers
114 views
Algorithm to detect if a list of strings need delimiters
I need to write a function to detect if a set of strings needs delimiters when concatenated in any order.
For example, the strings ("A","B","C") do not need a delimiter: "ABCBB" -> ...
1
vote
1answer
43 views
Patching data by identifying and copying repeating pattern
I have a dataset sampled with a specific pattern (timestamps). The very first repetition of the pattern is damaged, meaning that the values are nonsense.
To exemplify, my data looks like this:
data = ...
1
vote
1answer
28 views
Sorting algorithm for Provides/DependsOn objects
I have a set of type rewriters, each modifies a given C# type in a different way. Examples are:
Add the XYZ attribute to each property of the class
Add an ID property
Add two properties and some ...
2
votes
2answers
173 views
Merge sort and O(n log n) mystery
I read every explanation here but still not convinced. I think mergesort is n * n and I know I am wrong but not sure where. Here is what I think:
Suppose we are sorting 8 elements and this is the ...
3
votes
5answers
225 views
How to calculate winning chances of one poker hand against another? [closed]
My question relates to Texas Hold'em Poker. But I believe it will be the same algorithm for any kind of poker game.
So let's consider two hands: AJo and KQo. I can use online calculator and find out ...
1
vote
1answer
195 views
What is the meaning of “static” in pseudo-code
This is a pseudo-code from "Artificial Intelligence: A modern approach"
function Table-Driven-Agent(percept) returns action
static: percepts, a sequence, initially empty
table, a table, ...
-2
votes
1answer
89 views
Find missing number in sequence in string [closed]
I have a string that contains numbers in sequence. There are no delimiters between numbers. I have to find missing number in that sequence. For example:
176517661768 is missing the number: 1767
...
1
vote
1answer
55 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 ...
-4
votes
0answers
34 views
How to calculate the runtime and compare them? [duplicate]
Can someone help me on how to calculate the run times? For example:the following loop --
sum = 0;
for (i = 1; i < = n*n; i++)
for (j = 1; j <= i; j ++)
sum += i;
cout << sum;
...
0
votes
0answers
18 views
Extract the main entity from a body of text for text categorisation?
I'm trying to categorise products based on various fields of data. I've had some success just matching search terms in the product names, but this naive approach doesn't work when it comes to larger ...
0
votes
1answer
110 views
Algorithm to get all possible forms of a word with varying suffixes [closed]
I'm writing an application in javascript where given a word, I need to get all the possible versions of the word with the suffix being the difference between each form. For example:
"sponsor" should ...
4
votes
4answers
205 views
Selecting a CPU or microcontroller needed for a given software application?
Say I had a software algorithm (for example, an FFT), and I need it to process (n) amounts of data in (t) milliseconds. This is a real-time task written in C. There are a lot of CPUs out there, and ...
-2
votes
1answer
46 views
Considerations when making data structure and algorithm choices [closed]
What are some reasons you may choose a worse runtime algorithm? And what are some advantages of a linked list vs a hash table/array where access is constant time.
1
vote
1answer
34 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
1answer
160 views
Word game algorithm
Back in the days of 8-bit machines there existed an educational word game. I have no idea what it was actually called but for the sake of this question (since it involves pyramids) let's call it ...
2
votes
0answers
48 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 ...
8
votes
3answers
269 views
Generate equally sized areas in polygon
I am looking for a pseudo code logic that would find n equally sized areas in a given polygon. No space should be between or outside the matched areas. First valid match of areas should be returned.
...
2
votes
0answers
39 views
Polygon simplification that encloses original set of points
I have been trying to implement an optimization for 2D sprite rendering to fight the problem of limited fillrate on mobile devices. The idea is to render textured polygons instead of quads that will ...
1
vote
2answers
98 views
Find all paths in a tree type of structure
The language I am using is C#, but I am looking more for help with the algorithm more than I am concerned with which language. I have been trying to develop this algorithm for a while now and I can't ...
0
votes
2answers
181 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 ...
3
votes
1answer
140 views
Divide the world map into fixed sized blocks
I am developing an app where I need to divide the entire world map into fixed sized square blocks. For simplicity, think of it as a problem of dividing the google maps into a fixed sized block. I can ...
3
votes
1answer
89 views
Prorating a license (its expiry) dependent on feature add-ons
I've ran into a problem trying to calculate prorating of a service. Hoping to get some help/hint from the community.
I apologize if this isn't the right place to ask this question - will appreciate ...
5
votes
1answer
109 views
Finding similar high dimensional vectors
I have two lists (sizes m and n) containing high dimensional bit-vectors. All vectors have the same number of dimensions and use Hamming distance as measure if distance.
For each element in the first ...
0
votes
2answers
152 views
Optimization problem where to start, what algorithms to use? [closed]
I have an optimization problem and I was wondering where to start from to be able resolve it. I think it can be solved with an NP-complete algorithm but I am not sure where to start from. The problem ...
2
votes
2answers
74 views
Retrieving an incorrectly stored tree data structure
Way back in the hazy origins of our platform it was decided that we were going to need some hierarchical data structures stored in the RDBMS. The relationships between nodes were stored via a ...
2
votes
1answer
108 views
Improving sampling algorithm
I am having a bit of trouble designing a new feature at the moment. It is part of a resource management system. I was wondering if anyone has experience doing anything similar.
I'll try to explain:
...
4
votes
1answer
116 views
JavaScript functional conversion from flat list to tree
I've been going through the RxJS tutorials http://reactivex.io/learnrx/.
Almost all of the exercises involve moving from a hierarchical structure to a flat structure so I thought I'd try to do the ...