Skip to Content
C# Data Structures and Algorithms
book

C# Data Structures and Algorithms

by Marcin Jamro
April 2018
Intermediate to advanced content levelIntermediate to advanced
292 pages
6h 44m
English
Packt Publishing
Content preview from C# Data Structures and Algorithms

Tree

The whole tree is represented by an instance of the BinarySearchTree class, which inherits from the BinaryTree generic class, as in the following code snippet:

public class BinarySearchTree<T> : BinaryTree<T>  
    where T : IComparable 
{ 
} 

It is worth mentioning that a type of data, stored in each node, should be comparable. For this reason, it has to implement the IComparable interface. Such a requirement is necessary because the algorithm needs to know the relationships between values.

Of course, it is not the final version of the implementation of the BinarySearchTree class. You will see how to add new features, such as lookup, insertion, and removal of nodes, in the following sections.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Data Structures and Algorithms in C#

Beginning Data Structures and Algorithms in C#

Marcin Jamro

Publisher Resources

ISBN: 9781788833738Supplemental Content