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
20 views

What is (or where can i find) the algorithm to decode FLAC to PCM?

I'm trying to program a very basic FLAC player using 100% C# completely from scratch. My understanding of this type of thing is very limited, so I'm using this project as a way to learn about ...
-3
votes
0answers
53 views

How can I check if its a square or not? [on hold]

I would like to know and idea to check if its a square or not... I want to solve an algorithm that just reads x,y coordinates, and I have to calculate how many squares (4 side) I can detect. For ...
-4
votes
0answers
30 views

where can i learn about algorithms to help me solve problems that I might be asked when looking for a job [on hold]

as title says could someone point when can I learn about algorithms and solution to solve common problems that every programmers should be aware of?
1
vote
1answer
54 views

What is a good algorithm for tracing around the edge of a 2D polyline

If I have a polyline made up of any number of vertexes, what is an efficient algorithm for tracing around the boundary of this polyline? There are 4 situations to consider: The polyline does not ...
0
votes
0answers
14 views

Matlab contour matching [migrated]

I am working on matching 2D contours with metaheuristic. I have two images, I want to initialize my contours points in order to match them. But I did not get to do that. How to initialize these ...
1
vote
0answers
69 views

What algorithm should I use to create an automatic staff scheduling feature?

Imagine a small local business (in my case a dog daycare) with a few dozen part-time employees . The goal is to automatically create weekly staff schedules. My question is about what algorithmic ...
0
votes
1answer
55 views

Image coordinates calculation algorithm

I was looking at Jcrop library code for scaled image size calculation, but I couldn't clearly understand algorithm used in following function: ...
2
votes
1answer
84 views

Practical Primes In P

Or rather, practically applying PRIMES in P. I've heard a lot about "PRIMES in P", or the "AKS algorithm". It is, to oversimplify slightly, a very fast way of finding prime numbers. However, while ...
-4
votes
1answer
81 views

What's the algorithm of “Shuffle Mode” in audio/music players

I was researching on how is the "Shuffle mode" in music players implemented and what is the algorithm behind this. How it makes sure that any songs won't repeat? What's the most efficient algorithm ...
0
votes
1answer
82 views

Estimed number of tries

Problem: The Oscar Committee wants to decide which person should get the best actor award among the given N actors.For that they decided to use a random function random_bit() which returns either 0 ...
1
vote
0answers
50 views

Type inference + overloading [migrated]

I'm looking for a type inference algorithm for a language I'm developing, but I couldn't find one that suits my needs because they usually are either: à la Haskell, with polymorphism but no ad-hoc ...
11
votes
3answers
1k views

Would using a hash table in garbage collection solve the stop the world problem of mark and sweep?

In mark-sweep-compact garbage collection algorithm you have to stop-the-world when relocating objects because reference graph becomes inconsistent and you have to replace values of all references ...
-3
votes
1answer
67 views

Shuffle all songs iOS [closed]

How does iOS shuffle all songs pick which track to play? So search I found a theory that says, it has two different sets one set consists of song ID's that have been played and another set(set2) ...
5
votes
4answers
187 views

The optimal recipe problem

Suppose I have a list of Ingredients In My Fridge which are going off soon, and a list of Recipes which use up various Ingredients. (Some of which I don't currently have.) Is there an algorithm which ...
1
vote
0answers
142 views

Does a 15-puzzle always have a solution [migrated]

For those that are not familiar with (this type of) sliding puzzles, basically you have a number of tiles on a board equal to (n * m) - 1 (possibly more holes if you want). The goal is to re-arrange ...
3
votes
1answer
40 views

Difference in orientation of Sobel mask gives different edge detector result

I am implementing a Canny Edge detector for a class which I have based off the code found here. For the first derivative mask that I will convolve with the image, I am using the Sobel mask, although ...
3
votes
2answers
140 views

Search for the (slowly moving) number with penalty for too high test value

You task is to design a search algorithm that will find my secret number, which is between 0 and 2^64. If your test value is too low you can test again in 1 second. If your test value is too high you ...
0
votes
1answer
32 views

How can I approach creating an efficient algorithm for maximizing value with these specific constraints?

I'm having trouble coming up with an approach that isn't n^2 for this problem. Here's a contrived, simplified version I've come up with: Let's say you're a company that needs 4 employees to launch in ...
-1
votes
0answers
11 views

Finding in std::list [migrated]

Tell me please how to do that the best using STL. I have class that has a member std::list. It's private member. I have only const_iterator to begin and end. I'd like to check if list has some ...
2
votes
1answer
169 views

Is there a purely SQL alternate to looping?

Historically, I probably would have written a script (php or something) to loop through all spreadsheet rows and perform some calculations. I'm looking for a pure SQL solution on the presumption ...
0
votes
0answers
24 views

Algorithm for inserting into sorted subset

A is a sorted list. B is a sorted list, and a subset of A. If an element is inserted into A at index i what's the most efficient way to determine the correct index i' for it's position in B? Given ...
0
votes
1answer
39 views

Parallel radix sort algorithm

I am trying to implement radix sort. While I understand the radix sort for serial implementation, I am confused about parallel implementation. I am trying to implement the algorithm given in ...
2
votes
0answers
83 views

Why isn't there parallel reduction in the Standard Template Library?

Alexander Stepanov stated in talks and interviews that his realization that eventually lead him to generic programming and the Standard Template Library, was from the case of the parallel reduction ...
0
votes
0answers
42 views

Algorithm to Select Sequential Subarrays from an Array

I solved my problem by using simple nested loops and comparisons but I'm wondering if there is a well known Selection Algorithm to solve my problem. Let's say I have an array such as [1, 10, 250, 9, ...
0
votes
0answers
67 views

Algorithm / working approach to get a random list of data

I am working on a android schedule app but that isn't matter , the problem is a algorithm / methodology so you are welcome to just write the pusedo code to answer. The data is like this Place ...
1
vote
2answers
118 views

Smallest and Largest contiguous repeating sub-sequence in a sequence

I am trying to solve a outdated quiz problem. I am tasked to find the smallest and largest contiguous sequence of repeating numbers in a larger sequence.e.g. ...
3
votes
1answer
52 views

Comparing absolute values when determining zero crossing in 2D image

I am trying to implement an algorithm for finding the zero crossing (check that the signs of all the entries around the entry of interest are not the same) in a two dimensional matrix, as part of ...
0
votes
0answers
30 views

Maximize the visibility of an ad to a maximum of people in an automatic advertising system

I have N different ads that I want to display at the same time to M people in an automatic advertising system. Some people will never see some ads because they only check some specific criteria on the ...
2
votes
3answers
112 views

How to implement a Weighted shuffle

I recently wrote some code that I thought very inefficient, but since it included only a few values, I accepted it. However, I'm still interested at a better algorithm for the following: A list of ...
0
votes
1answer
109 views

Euclidean Space Fully Connected Nondirectional Graph: Shortest Path to all nodes

So this may be a question that is born of my inability to properly express my intentions to Google. In a fully connected non-directional graph such that any three points can be properly represented ...
0
votes
0answers
3 views

Number Patterns using loops in Java [migrated]

I have been trying different variations of for loops and have no clue how to make these patterns: Pattern 1 54321 5432 543 54 5 Pattern 2 1 12 123 1234 12345 Pattern 3 12345 2345 ...
-1
votes
1answer
67 views

Optimal movie schedule

Let's say Mr. A goes to cinema and he gets a movie schedule. There are N movies on the program today (1 < N < 50) and for every movie the time of the start and the time of the end are given in ...
1
vote
2answers
126 views

Given two sorted array in ascending order with same length N, calculate the Kth min a[i]+b[j]. Time complexity O(N)

Given two sorted array in ascending order with same length N, calculate the Kth min a[i]+b[j]. Time complexity O(N). Another variant of the question goes like this: given a matrix with sorted rows, ...
0
votes
3answers
249 views

Print bottom view of a binary tree

For a binary tree we define horizontal distance as follows: Horizontal distance(hd) of root = 0 If you go left then hd = hd(of its parent)-1, and if you go right then hd = hd(of its ...
3
votes
2answers
204 views

How to find number of points with same minimal distances on matrix

I'm trying to find the number of points in a matrix with the same minimal distances. Start with a MxN matrix, where M and N < 50000. There is given a set of fixed points, with their respective ...
0
votes
2answers
134 views

Solution Checker Algorithm for a Game

For the moment I'm strictly speaking in Pseudocode. I'd only like to see if i'm on the right track. The game I'm talking about is similar to a application called FLOW. In this game, you're given a ...
0
votes
1answer
197 views

Beginning Data Mining

For simplicity, my database has entities and transactions. Each transaction has a DateCreated and a foreign key to the entity. I'd like to have the ability to find entities that have had a recurring ...
0
votes
1answer
60 views

How can a route finding program avoid obstacles/locations when calculating routes? [closed]

Do you delete nodes from the underlying graph representation? Or is there a more elegant way to do it?
0
votes
0answers
21 views

Calculating combinations from categories

I'm trying to calculate every possible selection from different categories. 1 choice must be made from every category and the categories are always in the same order. I save a string where each ...
-1
votes
1answer
155 views

How to create a some kind of value for sentences? [closed]

I want to identify most matching sentence using some pattern. That means by using java algorithm I want to create identical value for each sentences.Each sentence when entering to that algorithm can ...
0
votes
0answers
28 views

Readers Writers algorithm help - starvation and no starvation

I found this link, as an explanation of r/w problem - http://pages.cs.wisc.edu/~bart/537/lecturenotes/s7.html But, I'm having problems realizing is there any starvation present here and why? Also, if ...
-1
votes
1answer
64 views

Difficulty implementing algorithms from abstract understanding [closed]

I've got decent programming experience for an undergraduate. I just started the study of algorithms. I read the description and saw visual examples that make perfect sense in my head. But when it ...
-5
votes
2answers
113 views

Best and worst case for the quicksort algorithm with 7 elements

part of my final project for my computer science class is developing a computer program that implements quicksort, but as a sort of pre-requisite, our teacher has given us this problem. Find 7 ...
1
vote
0answers
89 views

How to extract the active code path from a complex algorithm

I have been puzzled lately by an intruiging idea. I wonder if there is a (known) method to extract the executed source code from a large complex algorithm. I will try to elaborate this question: ...
2
votes
2answers
87 views

Set distances algorithm question

I have multiple sets containing integers. An integer maybe present in one set or multiple sets. I would like to find/match the sets with the most common integers. Example s1 {1, 2, 3, 4} s2 {1, 3, 4, ...
1
vote
2answers
184 views

What is a O(n) algorithm to solve this puzzle?

We are going to hold a meeting where everybody will speak in clockwise direction around a table. There are n people with n spots. Each person has a position preference (e.g. some want to go first, ...
0
votes
1answer
38 views

How do I mutate a value in a genetic algorithm using Gaussian distribution?

I've been reading 'Introduction to Evolutionary Algorithms'. This method is stated, but not described, and I can't find anything more specific online. p44/45 of 2nd Ed for reference. "adding to the ...
6
votes
1answer
133 views

Heuristic Approach for Flexible DIFF Implementation

I have created a DIFF implementation to compare document revisions at work. It is based on An O(ND) Difference Algorithm and Its Variations. One thing that has become important is to take the list ...
0
votes
1answer
125 views

How to develop an algorithm for brute-forcing / backtracking?

As a beginner programmer, I don't know how to conceptually think about brute-forcing. My mind can't really fathom how to write code that will try every possibility. I have a problem that I want to ...
1
vote
1answer
115 views

LLVM case: is the success due to the algorithms? [closed]

I'm not sure if this is a subjective question, I hope not but I'm not proficient with LLVM so I'm just wondering: how come it's become so popular and so widespread used in the industry? Were the ...