عرض المشاركات من مارس, 2015

## How to Find if Linked List contains Loops or Cycles in C#

In this post I will show you how to detect loop in linked list. We can find the loop in the linked list via Floyd’s Cycle-Finding Algorithm, explained here . The algorithm is pretty straightforward: We start at the begi…

## How to reverse a linked list in C#

In this post I will show you how to reverse a given linked list in c#.For example a given linked list as show below 10->20->30-NULL then output should be 30->20->10-NULL using System ; using System . Collections .…

## How to check a tree is a binary tree of not

This is continuation of my post How to create binary tree in c# .In this post I will show you how to check a given tree is a binary tree or not. public bool isBST ( ) { return ( IsBST ( _root ) ) ; …

## Mirror of a binary tree

This is continuation of my post How to create binary tree in c# .In this post I will show you how convert a given binary tree into it’s mirror image. /** Changes the tree into its mirror image. So the tree… 4 / \ 2 5 / \ 1…

## How to print out all path from root to leaf of a given binary tree

This is a continuation of my post How to create a binary tree in c# .In this post, I will show you how to print all path from root to leaf of a given binary tree in c#. Let’s consider following binary tree. 4 2 5 1 3 For the …

## Given a binary tree, find path sum

Given a tree and a sum returns true if there is a path from the root down to a leaf, such that adding up all the values along the path equals the given sum.let’s consider the following binary tree as an example, and the path sum…

## How to find min or max value in a given binary tree

This is a continuation of my post How to create a binary tree in c# .In this post, I will show you how to find max or min value in a given binary tree. Min Value: L oop down to find the leftmost leaf Max Value: Loop down to f…

## How to calculate max depth of given binary tree in c#

This is a continuation of my post How to create the binary tree in c# .In this post, I will show you how to calculate the max depth of a given binary tree in c#. max depth of a tree – the number of nodes along the longest …

## How to calculate size of binary tree

This is a continuation of my post How to create a binary tree in c# .In this post, I will show you how to find the size of the binary tree. Size of the binary tree is the number of nodes in a given tree. Following is the recurs…

## How to create binary search tree in c#

In computer science, binary search trees are a very essential data structure. They’re binary trees, as the name implies, with a value, a left child, and a right child for each node. The following is an important property of a…