Download presentation
Presentation is loading. Please wait.
Published byBrandon Shelton Modified over 8 years ago
1
Lab 3 Dictionary
2
Lab 3 SortedArray derived from dictionary will be provided sortedChain (interface) derived from dictionary will be provided Students will be asked to implement the member functions of sortedChain. Test program will be provided
3
Lab 3 Implement find, insert and erase function for sortedChain Due date: March 22
4
Find() template pair * sortedChain ::find(const K& theKey) const {} Return pointer to matching pair, return null if no matching pair. Start from firstNode, check if the node.first == theKey If find the matching pair, return the point, Else return null
5
Insert() template void sortedChain ::insert(const pair & thePair) {} If exists a pair with same key, update its value If no pair with same key, find the right position for the current pair and insert it into the dictionary Increase the dSize
6
Erase() template void sortedChain ::erase(const K& theKey) {} Delete the pair whose key equals theKey Find the pair whose key equals theKey, then delete it Descrease dSize;
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.