tagged [algorithm]

Creating a "spell check" that checks against a database with a reasonable runtime

Creating a "spell check" that checks against a database with a reasonable runtime I'm not asking about implementing the spell check algorithm itself. I have a database that contains hundreds of thousa...

Kinect pattern recognition

Kinect pattern recognition I bought a Kinect to play around with on my PC in C#. (And what fun it is to program!) I'm using CLNUIDevice.dll to get the depth image from Kinect. This works fine and I'm ...

Bad implementation of Enumerable.Single?

Bad implementation of Enumerable.Single? I came across this implementation in Enumerable.cs by reflector. ``` public static TSource Single(this IEnumerable source, Func predicate) { //check paramete...

31 Jan at 04:57

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

C# CRC implementation

C# CRC implementation I am trying to integrate a Serial-port device into my application, which needs CRC-CCTT validation for the bytes that I send to it. I'm kinda new into managing byte packets, and ...

21 Feb at 11:57

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

XIRR Calculation

XIRR Calculation How do I calculate Excel's `XIRR` function using C#?

3 Mar at 13:33

Boyer-Moore Practical in C#?

Boyer-Moore Practical in C#? Boyer-Moore is probably the fastest non-indexed text-search algorithm known. So I'm implementing it in C# for my [Black Belt Coder](http://www.blackbeltcoder.com) website....

Checking if all elements in a list are unique

Checking if all elements in a list are unique What is the best way (best as in the conventional way) of checking whether all elements in a list are unique? My current approach using a `Counter` is: Ca...

11 Mar at 23:14

How to calculate a standard deviation [array]

How to calculate a standard deviation [array] This code above is a short-handed sample of an unexpected behavior of an cumulative algorithm (see the bold value). In real, this is a class which also ho...

17 Mar at 09:25

shuffle (rearrange randomly) a List<string>

shuffle (rearrange randomly) a List I need to rearrange my List array, it has a non-determinable number of elements in it. Can somebody give me example of how i do this, thanks

21 Mar at 20:48

Match 2 lists of strings by ressemblance

Match 2 lists of strings by ressemblance I have 2 lists of strings. I want to find the best matching pairs from my lists. For example, I have those 2 lists: I want to get the following results: To com...

7 Apr at 20:21

When are bitwise operations appropriate

When are bitwise operations appropriate I am aware of the basic premise of what bitwise operation are (although would appreciate a "for dummies" explanation); however I am unaware of when it is approp...

how would i find the time and space complexity of this code?

how would i find the time and space complexity of this code? I am having difficulty finding space and time complexity for this code that i wrote to find number of palindromes in a string. ``` /** Thi...

How to manage large set of data on a mobile device

How to manage large set of data on a mobile device I am currently implementing a Japanese dictionary and would like some ideas on how to find entries in a fast and efficient manner. The dictionary ent...

Fastest way to fill an array with a single value

Fastest way to fill an array with a single value I would like to fill a 2D array with a single value that I have, however, I would like to do it the quickest way possible has the 2D array's length wil...

Digital camera algorithms

Digital camera algorithms I'm working on a simple video device and I'd like to introduce some standard cool camera features. Amongst all I'd like to introduce - - - Right now I'm looking for some exam...

12 May at 11:2

Recognizing handwritten shapes

Recognizing handwritten shapes I want to recognize handwriting shape and figure out which shape it probably is in the set. Simply saying, if I draw a triangle, the application should recognize it as a...

30 May at 05:30

Camera Module Focus Adjust using Contrast Transfer Function

Camera Module Focus Adjust using Contrast Transfer Function Currently I'm designing a test program for mobile phone camera module. I'm trying to control a precision motor that adjust the focus barrel ...

Algorithm: How do I fade from Red to Green via Yellow using RGB values?

Algorithm: How do I fade from Red to Green via Yellow using RGB values? I want to display a color based on a value from 0 to 100. At one end (100), it's pure Red, the other end (0), pure Green. In the...

18 Jun at 06:31

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

A fast array shift implementation in C#?

A fast array shift implementation in C#? I need to shift to the right and to the left an array by N places. The items that pop out on the side where i shift to must get back into on the other side. Th...

6 Jul at 21:7

Best way to track maximal distance in a set of points?

Best way to track maximal distance in a set of points? Assume that I have a collection of 2 dimensional points, and a way to determine the distance between them. This collection is frequently modified...

14 Jul at 23:24

Intersection between two rectangles in 3D

Intersection between two rectangles in 3D To get the line of intersection between two rectangles in 3D, I converted them to planes, then get the line of intersection using cross product of their norma...

Find smallest irregular polygon from combination of vertices (Performance Critical)

Find smallest irregular polygon from combination of vertices (Performance Critical) I need to find an irregular polygon with the smallest surface area out of several vertices on a 2D plane. There are ...

10 Sep at 19:33