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)

-3
votes
0answers
53 views

How can I oprimize this hash table in C? [on hold]

I want to run greedy algorithm to coloring vertex. A vertex is an unsigned int of 32 bit. And the hash table represents the important part of the graph. I must holds like 1 000 000 vertexes and edges, ...
1
vote
0answers
25 views

Yen's k shortest paths algorithm

I'm currently trying to understand Yen's k shortest paths algorithm. I based myself on the original paper as well as on the Wikipedia article, but still cannot see why it is correct if k > 2. In fact, ...
-4
votes
0answers
37 views

The path to learning algorithms and data structure - Am I doing it right? [on hold]

I'm trying to self-teach myself, to be a real, educated software engineer. I know math is important to gain more logical thinking and problem solving skills, and after that learning algorithms and ...
-1
votes
4answers
128 views

What algorithm would have the fastest average run time and least memory requirements for sorting a deck of playing cards?

Considering a deck of N playing cards with X different rankings and Y different suits (i.e. there are Y cards with X ranking, thus N=X*Y). What is the fastest algorithm to sort them assuming that X, ...
-4
votes
1answer
69 views

Generate this kind of 2d burst or pulse algorithm?

I'm currently trying to develop a game using Cocos2d-x using C++ I really need to generate this burst or (donut-shaped) pulse. I'm having a difficult time how to generate such shape. At first, I was ...
2
votes
3answers
167 views

Binary Search Tree without Natural Ordering

This is kind of a multi-part question. Is it possible to do a binary search tree if the data does not possess natural ordering? Would you be forced to impose artificial ordering to such data? Like ...
5
votes
5answers
245 views

My brute force solution is too slow, needed DP solution [on hold]

Concise problem definition: given n and {a,b,c}; (1 ≤ n, a, b, c ≤ 4000); Constraint -> a*i + b*j + c*k==n (i,j,k>=0); Objective-> maximize(i,j,k) Examples: n=47 and a=7,b=5,c=8 -> ...
0
votes
1answer
195 views

My algorithm is too slow

Reposted from Stack Overflow - I think this is a more appropriate place to ask the question. I have an algorithm that for an integer x and a starting integer i such that 1 < i < x the next ...
2
votes
1answer
263 views

What should I call this utility function? Is something like it commonly used?

Suppose you want to combine some arrays of objects that have similar properties: var people = [{name: 'Jack', age: 10}, {name: 'Jill', age: 12}] var items = [{owner: 'Jack', name: 'pail'}, {owner: ...
-5
votes
0answers
73 views

Algorithm for calculating the square root of a perfect square with infinite precision? [closed]

I have been trying this for 2 days but I can't find anything. I would like to know if there is a sub exponential time algorithm for calculating the square root of a big number with infinite precision. ...
0
votes
0answers
66 views

find the longest word made of other words

I am working on a problem, which is to write a program to find the longest word made of other words in a list of words. I post two versions of code, and wondering if IsComposite2 is more functionally ...
1
vote
0answers
38 views

Filtering algorithm for word game

Suppose you have a number of anagrams for the same letters, for example: alerting altering integral relating triangle Suppose you have a game where you must find all the anagrams, by placing letters ...
4
votes
1answer
123 views

Word ladder efficency problem

I have a problem dealing with word ladders. The problem is: given two words and a dictionary file, find the shortest word ladder between the two words. So if given the words cat and pot: cat -> ...
1
vote
1answer
89 views

Algorithm to create all unique sets of the alphabet using arbitrary group sizes

I'm looking for an algorithm to help me out with a combination of combinations problem. I have generated two lists of combinations of letters: (26 choose 6) & (26 choose 5) My goal is to be able ...
0
votes
0answers
22 views

How would I identify a gap in a set of curve data, and get its value?

I have a set of 2-D data (x,y) and it produces a set of curves, and sometimes the set of curves do not overlap, and there is a distinct separation between the groups of curves, how would I identify ...
0
votes
2answers
72 views

Ordering 'Tasks' for execution based on their dependencies

Let's say I have a set of Tasks that they have dependencies. These tasks are not in order, but the execution of tasks should be in the proper order. Each task has two properties: Before and After. ...
4
votes
0answers
64 views

Modelling a complex schedule of work

I've got a real-world problem that I'm trying to represent and automate. I've simplified and abstracted it down to the following: There are n places of work (P1, P2, ..., Pn). Each place, Pn has a ...
6
votes
1answer
87 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 | ...
1
vote
2answers
127 views

Binary Search O(log(n)) or O(n)

I see where most readings online derive that the Big-Oh notation of a Binary Search is O(log(n)), but doesn't this assume a balanced tree? What if the tree is completely unbalanced (i.e. similar to a ...
1
vote
0answers
51 views

Implementing an algorithm for parallel task scheduling

Problem Given a set of applications "A[]" with execution cost "Ex" ,Arrival Time "t", Resource requirements "R" and the system having free resources "Fr", calculate the finishing time of all of the ...
1
vote
1answer
76 views

Clairvoyance in caching - optimal strategies?

This question relates to the question here, but I'll generalise it so that you can answer effectively without reading all of that. Context: Imagine you had a large set of data greater than your ...
1
vote
2answers
50 views

Place X items in N matrices without repeat column and row

I have N matrices (n × m) and items to place in each one (n · m). The same items are repeated randomly for each matrix. When one item is placed in (i, j), for the following matrices the ...
2
votes
1answer
65 views

Caching in '3D' - data-structures and octree recursion - hrrm!

The Situation: I have 68GB of data that is conceptually realized as a 3D matrix of 8-bit values with dimension 4096*4096*4096. I need to access multiple sections of this data for processing in a ...
2
votes
4answers
448 views

What is Big-O notation for purely functional languages?

Is it still relevant? Instead of var result = new List<int>(); for (var i = 0; i < prev.Count; ++i) { result.Add(prev[i] * 2); } where the result.Add, prev[i], and * 2 instructions ...
0
votes
0answers
47 views

Algorithm and time-complexity of creating a sports schedule

With the NFL schedule being released last night, I started thinking. How would one automate the process of creating a schedule for a league such as the NFL? Even if we ignore all the challenges of a ...
0
votes
3answers
199 views

Algorithm to determine the fastest route passing in all points

Given a starting point A and an end point E, I need an algorithm to determine the minimum transit route in a city that passes through all points (A, B, C, D, E) and is the fastest possible. I know I ...
5
votes
2answers
166 views

Best compression algorithm for timelapse photos

I have a folder containing about 9,000 JPEG photos (about 30Gb), which I want to archive with some sort of compression. I understand that compressing JPEGs is not normally very effective, but these ...
0
votes
1answer
97 views

Calculating variable distances

I'm attempting to write an algorithm that calculates the distance between vertebrae. The text parser already works perfectly in picking out vertebral references (cervical 6, c-6, c6, c six, cervical ...
1
vote
1answer
75 views

Most efficient way to keep count of objects in State X without constantly counting

The application I work on manages hundreds of thousands of records each in a different state in their lifecycle. A large requirement is to have a nearly accurate count of these objects in each state ...
2
votes
1answer
133 views

Sudoku Solver BackTracking vs Simulated Annealing

Before you read any further, assume you know what sudoku game and how to go about solving it. So I have created a sudoku solver with brute-force: The algorithm goes as calculate(through an simple ...
0
votes
0answers
36 views

Algorithm for rate-limiting uploads with 3 files max

I want to limit file upload frequency to our webservice to prevent denial-of-service (directed at the server) - specifically, temporary folders filling up with fake uploads. This could be the user ...
2
votes
2answers
71 views

Algorithm for implementing QOS in my proxy

Here's the situation: I'm making a proxy (for the moment running on my laptop) which deals with HTTP(S) requests from incoming clients (for the moment only one client, i.e. my Chrome browser on my ...
5
votes
1answer
56 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
1answer
53 views

Matrix multiplication range queries

I have a huge list of matrix i.e A = {M0, M1, M2 .. Mn}. I have a task to find the product of all the matrices in a given range {x,y} i.e Mx * Mx+1 * Mx+2 ... * My. I would like to know if there is ...
1
vote
0answers
23 views

Create unique buckets for stream of entities based on constraints on the entity attributes

I have stream (magnitude 10s of millions) of entities, say Item which is modeled as below: class Item { String id; Double price; Double profitPercentage; Country originCountry; Country ...
1
vote
1answer
146 views

Complexity of recursive calls

my brain is a little stuck as I am trying to compile an example for my blog. I am presenting an algorithm that draws a number from an array, adds it to a sum and calls itself recursively. func ...
-2
votes
0answers
22 views

How to find the algorithmic complexity of this program? [duplicate]

I have the following program which finds out all the prime factors of a given number. Algorithm: Divide by 2 until the number is odd, for each successful division add 2 to list of prime factors. ...
0
votes
2answers
138 views

Check if list has a list of values

I have been trying to figure out an efficient algorithm that can check if a list of values contains a list of values. Both lists are sorted in ascending order. For example: Check if var ...
0
votes
1answer
45 views

Mapping match-up combinations into an integer

First of all, I want to say I wasn't sure if I should post this here or in math.stackexchange but I think the question is too programming-related to belong to the latter community. Definetly not a SO ...
-2
votes
1answer
68 views

Find largest subset where two elements share a property

I have a set of numbers S and I want to find the largest subset S' such that for any two elements x,y in S' property(x, y) == True in_relation(x,y) == True. How could I find it? Bruteforcing is an ...
1
vote
1answer
35 views

Why use last column of Burrows-Wheeler-Transform

The Burrows-Wheeler-Transform takes a string with length n, creates a matrix with n rows by shifting this string one position to the left for each row. Then the rows are sorted by the first column in ...
0
votes
0answers
51 views

How to solve min cost max flow program with brute force

I have a use case where I need to solve min cost max flow problem for nodes < 5. Implementing Cycle canceling or some other min cost max flow problem seems like a over kill for this, is there some ...
1
vote
1answer
120 views

How to implement k-means algorithm on RGB Images?

I want to apply the k-means algorithm on an RGB image data-set. I don't know how to proceed. You can mention basic step by step flow to proceed. I do know basics of Image Processing & OpenCV.
2
votes
0answers
46 views

Are there any generic algorithims or Python functions to help find the longest item in a JSON document?

I am trying to log a JSON error message to Google's Cloud Logging platform. Unfortunately, the maximum size message you can log is 8000 bytes and some of the JSON documents I want to log are larger ...
0
votes
1answer
298 views

One font OCR for meme images

I'm coding an Optical Character Recognition specifically for the Internet meme images. This is a school project and it should be coded in C. I'm currently having trouble with the method/algorithms I ...
1
vote
2answers
59 views

How to represent complex permissions system in single hash or set of characters?

Eve Online, a game I used to play, had an interesting "permissions" system for account interactions with other apps. The permissions encompassed dozens of individual permissions, each under a ...
-2
votes
1answer
79 views

Unable to Solve Dynamic Programming

I had an assignment on dynamic programming due last night, but I had to turn it in unfinished because i could not understand how to solve the last problem: The state wants to monitor traffic on a ...
1
vote
0answers
113 views

Which 3D algorithms does Windows 10's “3D Builder” application use?

Windows 10 ships with "3D Builder", a Universal App that contains utility functions to prepare STL, OBJ, 3DS, and other files that represent geometries for 3D printing. The utility looks like this: ...
1
vote
1answer
128 views

Best two-way compression algorithm for 32-bit numbers

I need to compress an id for marketing campaigns. The current campaign id is 32-bit integer but obviously this is too long for a customer to type by hand. I would like to compress this to minimum ...
1
vote
3answers
129 views

How do I generate multiple hashes that can be resolved to a single value?

I need multiple "random" URLs that just mask the original URL, i.e.: /ABC /CBA /CAB All resolve to /6 I came up with matching a letter to a number and then you can sum them to the single value. A ...