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

Kth Largest Element in Array

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,…

Levenshtein distance (Edit distance) - C#

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…

Longest increasing subsequence problem (Dynamic Programming)

The input consists of two sequences ~x = x1, . . . , xn and ~y = y1, . . . , ym. The goal is to find 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 = …

0/1 Knapsack Problem-C#

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…

Generate permutations of a given string in c#

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 …

Recursive merge sort implementation in c#

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…

Quick sort program in C# using recursion

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…

How to implement selection sort in c#

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…

C# Lambda Expression One-Liners

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 …

تحميل المزيد من المشاركات
لم يتم العثور على أي نتائج