Hashtableset failed

Place your order now for a similar assignment and have exceptional work written by our team of experts, At affordable rates

For This or a Similar Paper Click To Order Now

The Set Abstract Data Type (ADT) is an ADT that can store unique elements. Generally, the Set ADT is defined by the following operations:
size: Return the number of elements stored in the set
insert(x): Insert element x into this set (don’t allow duplicates)
remove(x): Remove element x from this set (if it exists)
find(x): Determine whether or not x exists in this set
We can implement the Set ADT using various data structures we have already learned about, and we can even simply wrap around existing C++ classes:
We can use an Array List, which is implemented in the C++ vector class
We can use a Linked List, which is implemented in the C++ list class
We can use a Red-Black Tree (RBT), which is implemented in the C++ set class
We can use a Hash Table, which is implemented in the C++ unordered_set class
We can use a Multiway Trie (MWT), which is not natively implemented in C++
We can use a Ternary Search Tree (TST), which is not natively implemented in C++
Task: Edit ArrayListSet.cpp
In this part of the assignment, we have provided a file called ArrayListSet.cpp that contains initial steps towards implementing the Set ADT using an Array List via the C++ vector 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 ArrayListSet.cpp: do not modify Set.h.
Task: Edit LinkedListSet.cpp
In this part of the assignment, we have provided a file called LinkedListSet.cpp that contains initial steps towards implementing the Set ADT using a Linked List via the C++ list 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 LinkedListSet.cpp: do not modify Set.h.
Task: Edit RedBlackTreeSet.cpp
In this part of the assignment, we have provided a file called RedBlackTreeSet.cpp that contains initial steps towards implementing the Set ADT using a Red-Black Tree via the C++ set 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 RedBlackTreeSet.cpp: do not modify Set.h.
Task: Edit HashTableSet.cpp
In this part of the assignment, we have provided a file called HashTableSet.cpp that contains initial steps towards implementing the Set ADT using a Hash Table via the C++ unordered_set 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 HashTableSet.cpp: do not modify Set.h.
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 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. 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.
Compiling and Running
We have provided a tester program, SetTest, that will help you test your code. You can compile your code using the provided Makefile via the make command:
$ make
g++ -Wall -pedantic -g -O0 -std=c++11 -o SetTest SetTest.cpp ArrayListSet.cpp
HashTableSet.cpp LinkedListSet.cpp MultiwayTrieSet.cpp RedBlackTreeSet.cpp
If you want to clean up your environment by deleting all the compiled executables, you can simply run make clean:
$ make clean
rm -f SetTest *.o
Here’s an example of how it should look like when it’s run from the command line:
$ ./SetTest
If nothing is printed by SetTest, then your functions for all of your classes are correct. Otherwise, SetTest will print out which classes are incorrect, such as the following:
$ ./SetTest
ArrayListSet failed
HashTableSet failed
LinkedListSet failed
MultiwayTrieSet failed
RedBlackTreeSet failed
Checking for Memory Leaks
As always, beware of memory leaks! You can use valgrind to check for memory leaks. For example, you can run it as follows:
valgrind –tool=memcheck –leak-check=yes ./SetTest
If it gives you a report like the following, you do not have memory leaks and are good to go (the important part is All heap blocks were freed — no leaks are possible):
==1482== Memcheck, a memory error detector
==1482== Copyright (C) 2002-2017, and GNU GPL’d, by Julian Seward et al.
==1482== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==1482== Command: ./SetTest
==1482==
==1482== error calling PR_SET_PTRACER, vgdb might block
==1482==
==1482== HEAP SUMMARY:
==1482== in use at exit: 0 bytes in 0 blocks
==1482== total heap usage: 29,796 allocs, 29,796 frees, 1,455,627 bytes allocated
==1482==
==1482== All heap blocks were freed — no leaks are possible
==1482==
==1482== For counts of detected and suppressed errors, rerun with: -v
==1482== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
If you do have memory leaks, the report will look something like the following:
==1516== Memcheck, a memory error detector
==1516== Copyright (C) 2002-2017, and GNU GPL’d, by Julian Seward et al.
==1516== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==1516== Command: ./SetTest
==1516==
==1516== error calling PR_SET_PTRACER, vgdb might block
==1516==
==1516== HEAP SUMMARY:
==1516== in use at exit: 941,480 bytes in 24,559 blocks
==1516== total heap usage: 29,822 allocs, 5,263 frees, 1,457,307 bytes allocated
==1516==
==1516== 941,480 (64 direct, 941,416 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 4
==1516== at 0x4C3017F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1516== by 0x112912: MultiwayTrieSet::MultiwayTrieSet() (MultiwayTrieSet.cpp:7)
==1516== by 0x10A134: main (SetTest.cpp:22)
==1516==
==1516== LEAK SUMMARY:
==1516== definitely lost: 64 bytes in 1 blocks
==1516== indirectly lost: 941,416 bytes in 24,558 blocks
==1516== possibly lost: 0 bytes in 0 blocks
==1516== still reachable: 0 bytes in 0 blocks
==1516== suppressed: 0 bytes in 0 blocks
==1516==
==1516== For counts of detected and suppressed errors, rerun with: -v
==1516== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

For This or a Similar Paper Click To Order Now

SmiteWriter
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.