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

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…

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

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 ) ) ; …

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…

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

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…

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 …

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…

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…