Click here to Skip to main content
15,884,176 members
Articles / Desktop Programming / MFC

Binary Search Tree Template

Rate me:
Please Sign up or sign in to vote.
3.65/5 (13 votes)
18 May 2006CPOL5 min read 72.8K   2.8K   20  
This is a class library, it can be used to create binary search tree of any basic data type or a class object.
#ifndef __TREE__TEMPLATE__NODE__H__
#define __TREE__TEMPLATE__NODE__H__

#pragma once

template <class T>
class CNode
{
public:
	T		m_Node ;
	CNode	*m_pLeft ;
	CNode	*m_pRight ;
	CNode	*m_pParent ;
public:
	CNode(void) ;
	CNode(T &obj) ;
	~CNode(void) ;
};

template <class T>
CNode<T>::CNode(void)
{
	m_pLeft = NULL ;
	m_pRight = NULL ;
	m_pParent = NULL ;
}

template <class T>
CNode<T>::CNode(T &obj)
{
	m_Node = obj ;
	m_pLeft = NULL ;
	m_pRight = NULL ;
	m_pParent = NULL ;
}

template <class T>
CNode<T>::~CNode(void)
{
}
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Other Microsoft
India India
I am currently working with Microsoft at Bangalore (India). My interest lies in areas of generic C++ and windows development. Apart from office hours I try to develop new and useful small tools.
Well, I still feel that I need to be more serious..!
Smile | :)

Comments and Discussions