Description
There’s many instances of red-black trees available throughout the internet for a variety of languages. Pick one and include it with your source code if the language you use does not have a built in one.
Using a red-black tree, build a sorted dictionary. This dictionary should be able to insert key/value pairs, retrieve values associated with keys, delete keys, and inform you whether or not a key exists in the dictionary. You do not need to do any error checking to determine if a key already exists when someone attempts to retrieve/delete an existing key.
Demonstrate that your sorted dictionary works by writing your program to insert into the dictionary the following key/value pairs:
Key Value
hello world
goodbye everyone
name student
occupation student
gpa 4.0
lab yes
assignment no
department cs
Then, retrieve the value of gpa and department and display it on the screen.
Reviews
There are no reviews yet.