Question
Task: Edit MultiwayTrieSet.cpp Imagine we want to insert n elements of length k into our set. Array Lists, Linked Lists, and Red-Black Trees all
Task: Edit MultiwayTrieSet.cpp\ \ Imagine we want to insert n elements of length k into our set. Array Lists, Linked Lists, and Red-Black Trees all scale as a function of n in the average and worst cases, and although Hash Tables are O(k) in the average case, they scale as a function of n in the worst case, and they have no inherent order. Instead, if we implement the Set ADT using a Multiway Trie, our find, insert, and remove operations will all be O(k) in the worst case, meaning our data structure's runtime will not worsen as n increases, and we can iterate over our elements in sorted order.\ \ In the case of a relatively sparse Multiway Trie (i.e., in which nodes have relatively few children), we could save some memory by using a Hash Map to represent child pointers instead of an array, which would give us O(k) time complexity in the average (rather than worst) case.\ \ In this part of the assignment, we have provided a file called MultiwayTrieSet.cpp that contains initial steps towards implementing the Set ADT using a Multiway Trie in which child pointers are stored in a Hash Map via the C++ unordered_map class. Function headers (with usage details) are included in Set.h. Your task is to fill in the missing code. Be sure to only modify MultiwayTrieSet.cpp: do not modify Set.h.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started