tagged [algorithm]

How to find the periodicity in data?

How to find the periodicity in data? I have a dataset (an array) and I need to find the periodicity in it. How should I proceed? Somebody said I can use FFT but I am not sure how will it give me the p...

18 Dec at 20:26

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/...

4 Oct at 02:37

How to create pastel colors programmatically in C#?

How to create pastel colors programmatically in C#? To generate them equally spaced out based on the number of colors wanted. Something that looks like this if 8 is given for the count specified: ![en...

19 Oct at 04:39

Finding all possible combinations of numbers to reach a given sum

Finding all possible combinations of numbers to reach a given sum How would you go about testing all possible combinations of additions from a given set `N` of numbers so they add up to a given final ...

Swap two variables without using a temporary variable

Swap two variables without using a temporary variable I'd like to be able to swap two variables without the use of a temporary variable in C#. Can this be done?

16 Sep at 03:33

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...

28 Nov at 17:31

Calculate distance between two latitude-longitude points? (Haversine formula)

Calculate distance between two latitude-longitude points? (Haversine formula) How do I calculate the distance between two points specified by latitude and longitude? For clarification, I'd like the di...

How to find the kth largest element in an unsorted array of length n in O(n)?

How to find the kth largest element in an unsorted array of length n in O(n)? I believe there's a way to find the kth largest element in an unsorted array of length n in O(n). Or perhaps it's "expecte...

15 Sep at 02:37

Unfamiliar symbol in algorithm: what does ∀ mean?

Unfamiliar symbol in algorithm: what does ∀ mean? I'm reading about an algorithm (it's a path-finding algorithm based on A*), and it contains a mathematical symbol I'm unfamiliar with: ∀ Here is the c...

30 Jan at 13:13

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...

23 Aug at 06:47

Perlin Noise for 1D?

Perlin Noise for 1D? Try as hard as I can, I cannot find any real tutorials on Perlin\Samplex Noise in 1D. I've searched all around the internet but just cannot find anything. Any sites I do come acro...

10 Jan at 05:21

Best way to randomize an array with .NET

Best way to randomize an array with .NET What is the best way to randomize an array of strings with .NET? My array contains about 500 strings and I'd like to create a new `Array` with the same strings...

24 Oct at 16:19

How to reverse a number as an integer and not as a string?

How to reverse a number as an integer and not as a string? I came across a question "How can one reverse a number as an integer and not as a string?" Could anyone please help me to find out the answer...

19 May at 14:47

Is it possible to get all arguments of a function as single object inside that function?

Is it possible to get all arguments of a function as single object inside that function? In PHP there is [func_num_args](http://php.net/manual/en/function.func-num-args.php) and [func_get_args](http:/...

What are the practical factors to consider when choosing between Depth-First Search (DFS) and Breadth-First Search (BFS)?

What are the practical factors to consider when choosing between Depth-First Search (DFS) and Breadth-First Search (BFS)? I understand the differences between DFS and BFS, but I'm interested to know w...

Multiple Date range comparison for overlap: how to do it efficiently?

Multiple Date range comparison for overlap: how to do it efficiently? To check for overlap in two different dateranges, `{Start1, End1}` and `{Start2, End2}` I am checking: The question is, . If I hav...

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...

11 Nov at 09:50

C# Determine Duplicate in List

C# Determine Duplicate in List Requirement: In an unsorted List, determine if a duplicate exists. The typical way I would do this is an n-squared nested loop. I'm wondering how others solve this. Is t...

22 Feb at 15:59

How to draw gridline on WPF Canvas?

How to draw gridline on WPF Canvas? I need to build a function drawing gridline on the canvas in WPF: ![example gridline](https://i.stack.imgur.com/XHVJv.png) How would I go about this?

22 Jun at 02:42

Calculate mean and standard deviation from a vector of samples in C++ using Boost

Calculate mean and standard deviation from a vector of samples in C++ using Boost Is there a way to calculate mean and standard deviation for a vector containing samples using [Boost](http://en.wikipe...

17 Dec at 18:4

Big O, how do you calculate/approximate it?

Big O, how do you calculate/approximate it? Most people with a degree in CS will certainly know what [Big O stands for](http://www.nist.gov/dads/HTML/bigOnotation.html). It helps us to measure how wel...

Fibonacci, Binary, or Binomial heap in c#?

Fibonacci, Binary, or Binomial heap in c#? Are there any heap data structure implementations out there, fibonacci, binary, or binomial? Reference: These are data structures used to implement priority ...

9 Jan at 16:50

Effective method to hide email from spam bots

Effective method to hide email from spam bots On my homepage, I'm using this method to hide my email from spam bots: What do you think about it? Is it effective? What other methods do you know or use?

26 Apr at 10:28

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...

7 Aug at 13:57

Best way to find position in the Stream where given byte sequence starts

Best way to find position in the Stream where given byte sequence starts How do you think what is the best way to find position in the System.Stream where given byte sequence starts (first occurence):...

24 Sep at 14:17