tagged [algorithm]
Name of a particular algorithm
Name of a particular algorithm I'm trying to determine the name of the algorithm which will determine if a set of blocks listed as Xl,Yl-X2Y2 are part of a contiguous larger block. I'm just really loo...
- Modified
- 28 Nov at 17:31
Random playlist algorithm
Random playlist algorithm I need to create a list of numbers from a range (for example from x to y) in a random order so that every order has an equal chance. I need this for a music player I write in...
- Modified
- 1 Dec at 20:57
Bubble sort worst case example is O(n*n), how?
Bubble sort worst case example is O(n*n), how? I am trying Bubble sort. There are 5 elements and array is unsorted. Worst case for bubble sort shuold be O(n^2). As an exmaple I am using A = {5, 4, 3, ...
Mapping a range of values to another
Mapping a range of values to another I am looking for ideas on how to translate one range values to another in Python. I am working on hardware project and am reading data from a sensor that can retur...
What is the fastest way to count the unique elements in a list of billion elements?
What is the fastest way to count the unique elements in a list of billion elements? My problem is not usual. Let's imagine few billions of strings. Strings are usually less then 15 characters. In this...
- Modified
- 13 Jan at 01:19
Efficient Cartesian Product algorithm
Efficient Cartesian Product algorithm Can somebody please demonstrate for me a more efficient Cartesian product algorithm than the one I am using currently (assuming there is one). I've looked around ...
- Modified
- 21 Jan at 14:23
Are unescaped user names incompatible with BNF?
Are unescaped user names incompatible with BNF? I've got a (proprietary) output from a software that I need to parse. Sadly, there are unescaped user names and I'm scratching my hairs trying to know i...
- Modified
- 23 Jan at 19:51
Rotating a point about another point (2D)
Rotating a point about another point (2D) I'm trying to make a card game where the cards fan out. Right now to display it Im using the Allegro API which has a function: so with this I can make my fan ...
Facial recognition/merging software
Facial recognition/merging software Can anyone point me in the right direction of some facial recognition libraries & algorithms ? I've tried searching/googling but i mostly find thesises and very lit...
- Modified
- 16 Feb at 12:34
Check if any item in a list matches any item in another list
Check if any item in a list matches any item in another list A coleague asked me to write a one-liner to replace the following method: ``` public static bool IsResourceAvailableToUser(IEnumerable reso...
List all possible combinations of k integers between 1...n (n choose k)
List all possible combinations of k integers between 1...n (n choose k) Out of no particular reason I decided to look for an algorithm that produces all possible choices of k integers between 1...n, w...
- Modified
- 13 Apr at 14:10
.NET Geometry Library
.NET Geometry Library Does anyone know of a good (efficient, nice API, etc.) geometry open source library for .NET? Some of the operations needed: - - `float``double`- - - - - `float``double`- - -
- Modified
- 17 Apr at 20:59
Algorithm for Source Control System?
Algorithm for Source Control System? I need to write a simple source control system and wonder what algorithm I would use for file differences? I don't want to look into existing source code due to li...
- Modified
- 18 Apr at 06:41
How to write an algorithm to check if the sum of any two numbers in an array/list matches a given number?
How to write an algorithm to check if the sum of any two numbers in an array/list matches a given number? How can I write an algorithm to check if the sum of any two numbers in an array/list matches a...
- Modified
- 19 Apr at 10:40
Most efficient algorithm for merging sorted IEnumerable<T>
Most efficient algorithm for merging sorted IEnumerable I have several huge . Theses lists are manipulated as `IEnumerable` but are . Since input lists are sorted, it should be possible to merge them ...
- Modified
- 4 May at 16:15
Stack and Hash joint
Stack and Hash joint I'm trying to write a data structure which is a combination of Stack and HashSet with fast push/pop/membership (I'm looking for constant time operations). Think of Python's Ordere...
Generate 2D cross-section polygon from 3D mesh
Generate 2D cross-section polygon from 3D mesh I'm writing a game which uses 3D models to draw a scene (top-down orthographic projection), but a 2D physics engine to calculate response to collisions, ...
What guarantees are there on the run-time complexity (Big-O) of LINQ methods?
What guarantees are there on the run-time complexity (Big-O) of LINQ methods? I've recently started using LINQ quite a bit, and I haven't really seen any mention of run-time complexity for any of the ...
- Modified
- 9 May at 22:50
Genetic Programming in C#
Genetic Programming in C# I've been looking for some good genetic programming examples for C#. Anyone knows of good online/book resources? Wonder if there is a C# library out there for Evolutionary/Ge...
- Modified
- 17 May at 03:14
What is the best way to find the digit at n position in a decimal number?
What is the best way to find the digit at n position in a decimal number? ### Background I'm working on a symmetric rounding class and I find that I'm stuck with regards to how to best find the number...
traveling salesman problem, 2-opt algorithm c# implementation
traveling salesman problem, 2-opt algorithm c# implementation Can someone give me a code sample of 2-opt algorithm for traveling salesman problem. For now im using nearest neighbour to find the path b...
- Modified
- 28 May at 10:54
how to develop a program to minimize errors in human transcription of hand written surveys
how to develop a program to minimize errors in human transcription of hand written surveys I need to develop custom software to do surveys. Questions may be of multiple choice, or free text in a very ...
- Modified
- 4 Jun at 05:29
Split String into smaller Strings by length variable
Split String into smaller Strings by length variable I'd like to break apart a String by a certain length variable. It needs to bounds check so as not explode when the last section of string is not as...
Doubling a number - shift left vs. multiplication
Doubling a number - shift left vs. multiplication What are the differences between and ``` int size = length
algorithm challenge: merging date range
algorithm challenge: merging date range I'm facing an interesting problem: - - Is it possible to "des-overlap" theses ranges? That is, to generate: - - Maybe I can make this a bit more graphical. This...
- Modified
- 1 Jul at 08:14
Asymptotically Fast Associative Array with Low Memory Requirements
Asymptotically Fast Associative Array with Low Memory Requirements Ok, tries have been around for a while. A typical implementation should give you O(m) lookup, insert and delete operations independen...
- Modified
- 26 Jul at 14:51
C# hashcode for array of ints
C# hashcode for array of ints I have a class that internally is just an array of integers. Once constructed the array never changes. I'd like to pre-compute a good hashcode so that this class can be v...
Recommended Open Source C# algorithms & data structures libraries
Recommended Open Source C# algorithms & data structures libraries What algorithms libraries can you recommend? The basic criteria are: - - - Algorithms libraries I have used and can recommend: - [Quic...
Calculate coordinates of a regular polygon's vertices
Calculate coordinates of a regular polygon's vertices I am writing a program in which I need to draw polygons of an arbitrary number of sides, each one being translated by a given formula which change...
I need an optimal algorithm to find the largest divisor of a number N. Preferably in C++ or C#
I need an optimal algorithm to find the largest divisor of a number N. Preferably in C++ or C# I am currently using the following code but its very slow for large numbers ``` static int divisor(int nu...
selection based on percentage weighting
selection based on percentage weighting I have a set of values, and an associated percentage for each: a: 70% chance b: 20% chance c: 10% chance I want to select a value (a, b, c) based on the percent...
What is the most efficient pattern/algorithm to compare two lists and find the delta between those two lists?
What is the most efficient pattern/algorithm to compare two lists and find the delta between those two lists? We have two lists, let's say students and their scores. I want to compare these two lists ...
- Modified
- 10 Sep at 21:4
C# Diff Algorithm for Text
C# Diff Algorithm for Text I'm looking for a diff algorithm that will produce results like SO's edit revisions page. I've more or less just started looking and I'm not opposed to doing it myself but I...
Implementing a sparse array in C# / fastest way to map integer to a specific bucket/range number
Implementing a sparse array in C# / fastest way to map integer to a specific bucket/range number My initial problem is that I need to implement a very fast, sparse array in C#. Original idea was to us...
C# implementation of Google's 'Encoded Polyline Algorithm'
C# implementation of Google's 'Encoded Polyline Algorithm' Does anyone have a concise and robust implementation of Google's [Encoded Polyline Algorithm](http://code.google.com/apis/maps/documentation/...
- Modified
- 4 Oct at 02:37
In C# is it a good practice to use recursive functions in algorithms?
In C# is it a good practice to use recursive functions in algorithms? In many functional languages using a recursion is considered to be a good practice. I think it is good because of the way compiler...
- Modified
- 21 Oct at 09:47
What's the fastest way to compare two arrays for equality?
What's the fastest way to compare two arrays for equality? I have two arrays of objects which are likely to have the same values, but in a different order, e.g. I wish to treat these two arrays as equ...
How to compute frequency of data using FFT?
How to compute frequency of data using FFT? I want to know the frequency of data. I had a little bit idea that it can be done using FFT, but I am not sure how to do it. Once I passed the entire data t...
- Modified
- 20 Nov at 01:42
Overriding GetHashCode
Overriding GetHashCode As you know, GetHashCode returns a semi-unique value that can be used to identify an object instance in a collection. As a good practice, it is recommended to override this meth...
- Modified
- 21 Nov at 21:27
Faster Algorithm for string comparing in c#
Faster Algorithm for string comparing in c# I have two sentences that needed to be compared to each-other. The final result is how much percent one sentence contains in the other, my problem is that I...
How to prove that a problem is NP complete?
How to prove that a problem is NP complete? I have problem with scheduling. I need to prove that the problem is NP complete. What can be the methods to prove it NP complete?
- Modified
- 27 Nov at 22:30
Generate large prime number with specified last digits
Generate large prime number with specified last digits Was wondering how is it possible to generate 512 bit (155 decimal digits) prime number, last five decimal digits of which are specified/fixed (eg...
How is a random number generated at runtime?
How is a random number generated at runtime? Since computers cannot pick random numbers(can they?) how is this random number actually generated. For example in C# we say, What happens inside?
- Modified
- 14 Dec at 15:29
.NET library for text algorithms?
.NET library for text algorithms? Do you know any .NET library for text algorithms?? Especially I'm interested in strings match, and full-text-search algorithms like - - - I know the one I have mentio...
- Modified
- 22 Dec at 10:39
C#: Seeking PNG Compression algorithm/library
C#: Seeking PNG Compression algorithm/library I need to compress or at least drop the quality of some png images that users are uploading to my site. I already resized it but that doesn't do much for ...
Sparse O(1) array with indices being consecutive products
Sparse O(1) array with indices being consecutive products I'd like to pre-calculate an array of values of some unary function `f`. I know that I'll only need the values for `f(x)` where `x` is of the ...
- Modified
- 16 Jan at 22:5
Shuffle string c#
Shuffle string c# I want to know shuffle string string I would be able to get:
- Modified
- 19 Jan at 19:48
Detect a specific frequency/tone from raw wave-data
Detect a specific frequency/tone from raw wave-data I am reading a raw wave stream coming from the microphone. (This part works as I can send it to the speaker and get a nice echo.) For simplicity let...