Click here to Skip to main content
11,496,146 members (162 online)
Click here to Skip to main content
Add your own
alternative version

Red-Black Trees in C#

, 14 Sep 2004 CPOL 167.4K 4.4K 86
A C# implementation of a Red-Black Tree.
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
redblackcs_src.zip
RedBlackCS
bin
Release
RedBlackCS.dll
obj
Release
temp
TempPE
RedBlackCS.csproj.user
Test
bin
release
RedBlackCS.dll
Test.exe
obj
Release
temp
TempPE
Test.csproj.user
using System;

namespace Test
{
	//
	// demonstrates using a key as a separate object
	//
	
	public class MyKey : IComparable
	{
		private int intMyKey;
		public	int Key
		{
			get
			{
				return intMyKey;
			}
			
			set
			{
				intMyKey = value;
			}
		}
		
		public MyKey(int key) 
		{
			intMyKey = key;
		}
		
		public int CompareTo(object key)
		{
			if(Key > ((MyKey)key).Key)
				return 1;
			else
				if(Key < ((MyKey)key).Key)
				return -1;
			else
				return 0;
		}

		public override string ToString()
		{
			return intMyKey.ToString();
		}
	}
}

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)

Share

About the Author

RoyClem
Architect
United States United States
Roy is a software developer who digs all aspects of software development, from design and architecture to implementation.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 14 Sep 2004
Article Copyright 2004 by RoyClem
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid