Pages

Merge Sort Algorithm in C#

Here is the code:


        public int[] MergeSort(int[] arr)
        {

Merge two sorted arrays to one array in C#

Here is the code:
        public static int[] Merge(int[] nums1,  int[] nums2)

Binary search algorithm with recursion in C#

Here is the code:

    public int Search(int[] nums, int target) { 

Binary search algorithm without recursion in C#. Made it easy to understand.

Here is the Code:

    public int Search(int[] nums, int target) { 
        int s=0;

Rotate Array to K places in C#

Given an array, rotate the array to the right by k steps, where k is non-negative.
Example 1:
Input: [1,2,3,4,5,6,7] and k = 3

Optimal Maximum distance traveled problem

Given max travel distance, forward and backwards routes, return the routes which utilizes maximum travel distance.
Example:
Forward route : [[1,3000],[2,5000],[3,4000],[4,10000],[5,8000]]
Backward route : [[1,1000],[2,3000],[3,4000]]
Max Distance Traveled: 11000

Check if path exists between two nodes in a graph using Breadth first search (BFS)

Here is the code:

class Program
    {
        static List<int> li = new List<int>();
        static void Main(string[] args)
        {         
            node r0 = new node(0);

Check if path exists between two nodes in a graph using Depth first search (DFS)

Here is the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication75
{
    class Program
    {
        static List<int> li = new List<int>();
        static void Main(string[] args)
        {         
            node r0 = new node(0);

Breadth first search (BFS) Levels implementation in C#

Here is the code:

 class Program
    {
        static List<int> li = new List<int>();
        static void Main(string[] args)
        {         
            node r0 = new node(0);
            node r1 = new node(1);

Breadth first search (BFS) Graphs implementation in C#

Here is the code:
 class Program
    {
        static List<int> li = new List<int>();
        static void Main(string[] args)
        {         
            node r0 = new node(0);

Depth First Search (DFS) Graphs implmentation in C#. Made it easy to understand.

Here is the Code:

class Program
    {

        static List<int> li = new List<int>();
        static void Main(string[] args)
        {         
            node r0 = new node(0);

How to create a Quene data structure in C#

Here is the Code:

class Program
    {
        static void Main(string[] args)
        {
            Quene q = new Quene();
 //   This Solution is written by me and is not completely tested. Please comment if you found any alternative solutions or any enhancement to my solution.
            q.add(1);

How to create Stack data structure in C# with Push() and Pop() functions

Here is the Code:

  class Program
    {
        static void Main(string[] args)
        {
    //   This Solution is written by me and is not completely tested. Please comment if you found any alternative solutions or any enhancement to my solution.
            stack s = new stack();

Function to Sort elements of a Linked List in C#

Here is the code:

    class Program
    {
        static void Main(string[] args)
        {
    //   This Solution is written by me and is not completely tested. Please comment if you found any alternative solutions or any enhancement to my solution.
            LinkedList l = new LinkedList();

Function to Display elements of the LinkedList from Kth integer in C#

Here is Code:
 class Program
    {
        static void Main(string[] args)
        {
    //   This Solution is written by me and is not completely tested. Please comment if you found any alternative solutions or any enhancement to my solution.
            LinkedList l = new LinkedList();

Function to Display elements of Linked List in C#

Here is the code:
 class Program
    {
        static void Main(string[] args)
        {
    //   This Solution is written by me and is not completely tested. Please comment if you found any alternative solutions or any enhancement to my solution.
            LinkedList l = new LinkedList();

Function to Remove Middle element of Linked List in C#

Here is the code:

class Program
    {
        static void Main(string[] args)
        {
    //   This Solution is written by me and is not completely tested. Please comment if you found any alternative solutions or any enhancement to my solution.
            LinkedList l = new LinkedList();

Function to Reverse Linked List in C#

Here is the Code:

class Program
    {
        static void Main(string[] args)
        {
       //   This Solution is written by me and is not completely tested. Please comment if you found any alternative solutions or any enhancement to my solution.
            LinkedList l = new LinkedList();

Function to remove an item from Linked List in C#

Here is the code:

 class Program
    {
        static void Main(string[] args)
        {
       //   This Solution is written by me and is not completely tested. Please comment if you found any alternative solutions or any enhancement to my solution.
            LinkedList l = new LinkedList();

Sorting collection of Integers using Quick Sort Algorithm

Here is the code:

class Program
    {
        //   This Solution is written by me and is not completely tested. Please comment if you found any alternative solutions or any enhancement to my solution.
        static void Main(string[] args)
        {
            int[] a1 = new int[] { 5, 3, 5, 2, 1, 0, 8, 10, 9, 20, 32 };

Popular Posts