عرض المشاركات من أبريل, ٢٠١٣

Problem Description: Given an array A[] of n elements and a positive integer K, find the Kth smallest element in the array. It is given that all array elements are distinct. For Example: Example 1 Input : A[] = {10, 3, 6, 9, 2,…

In this article, I will show you how to implement edit distance( Levenshtein) algorithm in C#. We also see how to print the result. The Levenshtein distance is a measure of the number of changes (insertions, deletions or substi…

The input consists of two sequences ~x = x1, . . . , xn and ~y = y1, . . . , ym. The goal is to ﬁnd a longest common subsequence of ~x and ~y For example, let ~x and ~y be two DNA strings ~x = TGACTA and ~y = GT GCATG ; n = …

As per the Wikipedia The knapsack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a value, determine the number of each item included in a collection so that the total weight i…

In this post, I will show you how to generate the permutations of a given string in c#. This problem is a perfect example of the recursion technique. What is recursion In computer science, recursion is a programming technique …

In this article, I will show you the implementation of Merge Sort the algorithm in C#. What is merge sort? Merge sort is a divide-and-conquer algorithm based on the idea of breaking down a list into several sub-lists unti…

Sorting is essential in applications to arrange the data in ascending or descending order. In this article, I will show you how to implement Quick Sort in C#. Quick Sort Quicksort is a very efficient sorting algorithm inven…

In this post, I will show you how to implement selection sort in c#. Before going to implement selection sort, let’s describe how selection sort works. Go through the list one item at a time. Keep track of the smallest item f…

LINQ is a very popular feature of C#. You can write complex code in a lesser line. In this post, I will show you some one-liner Lambda expression. Write a factorial function using the lambda expression Func < int , int …