Skip to main content

Module avlmap

Module avlmap 

Source
Expand description

§CSC 7B/FC Rust Assignment 2

Study the implementation of the crate::avltree module. Then complete the implementation of the AVLMap data structure, which has a skeleton in this module. Some of the functions you will have to define just involve calling the equivalent function on [avltree::AVLSet], but others you will have to re-define from scratch, following the sample code in crate::avltree, because you will have to separate the key from the value. A “map” as opposed to a “set” contains key-value pairs. The key implements the std::cmp::Ord and std::cmp::Eq traits, but the value type can be anything. The tree is ordered and searched by the key.

Note: cargo new your own crate and copy whatever you need into it: don’t try to edit this crate directly.

Additional Requirement: all your functions (and any structs/enums) must be properly documented using cargo doc.

Structs§

AVLMap
Wrapper for an AVL “map” (as opposed to “set”).
Your assignment is to complete the implementation of this class by modifying or adding the following methods.
KVPair
A key-value pair:

Functions§

newpair
convenient function to create a KVPair