Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C++ using hash table(PLEASE): For this assignment you must construct the set data structure. Specifically, your sets will be storing playing cards, taken from

IN C++ using hash table(PLEASE):

For this assignment you must construct the set data structure. Specifically, your sets will be storing playing cards, taken from a standard deck of 52 playing card (no joker!). Your solution must implement the following:

(10 points) A class (or struct) to contain the playing card information (face and suite).

This class must be able to retrieve the face and suite

A print method which prints out: Face of Suite (Eight of Hearts, Queen of Spades, )

(80 points) An implementation of a set.

(10 points) Use a hash table (with either chaining or linear probing as the collision detection) to store your card objects. (+5 bonus points if you implement a resize of the hash table when it reaches 75% capacity)

(10 points) The set property (every item must be distinct/unique) must be obeyed.

(5 points) Efficient insertion of new card elements

(5 points) Efficient search for elements (Both require a good hash function)

(5 points) Print the contents of the set

(15 points) The set union operation

(15 points) The set intersection operation

(15 points) The set difference operation

Once you have completed the set implementation, your solution must be able to do the following:

(10 points) Load in four sets of playing cards (hand1.txt, hand2.txt, hand3.txt, hand4.txt), and place each in their own set. Note that there may be duplicate cards in each file, your set must handle those appropriately.

(20 points) Determine if among the four sets, you achieve the universal set of playing cards Included in the assignment archive is deck.txt, which contains all 52 cards. Load deck.txt into a 5th set object and compare it with the result of unioning all four sets.

(20 points) Determine the unique cards between sets (i.e. what cards does hand1 have that are not in hand2? Not in hand3? ). Are there any cards that are found in only one hand?

(20 points) Determine the extra cards (cards which are found in multiple hands). What is the most common card present? (Note do NOT count cards that are entered multiple times into the data files, only count cards which are present in finished sets).

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Deck:

Two Clubs Three Clubs Four Clubs Five Clubs Six Clubs Seven Clubs Eight Clubs Nine Clubs Ten Clubs Jack Clubs Queen Clubs King Clubs Ace Clubs Two Diamonds Three Diamonds Four Diamonds Five Diamonds Six Diamonds Seven Diamonds Eight Diamonds Nine Diamonds Ten Diamonds Jack Diamonds Queen Diamonds King Diamonds Ace Diamonds Two Hearts Three Hearts Four Hearts Five Hearts Six Hearts Seven Hearts Eight Hearts Nine Hearts Ten Hearts Jack Hearts Queen Hearts King Hearts Ace Hearts Two Spades Three Spades Four Spades Five Spades Six Spades Seven Spades Eight Spades Nine Spades Ten Spades Jack Spades Queen Spades King Spades Ace Spades

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Hand1

King Diamonds Three Hearts Three Diamonds Seven Clubs Three Clubs Jack Clubs Nine Hearts Ten Diamonds Four Clubs Ten Hearts King Clubs Jack Hearts Eight Spades Five Clubs Nine Clubs Seven Clubs Ace Spades Two Hearts Jack Spades Ten Diamonds Two Hearts Nine Clubs Seven Spades Ace Clubs Ten Clubs Two Hearts Queen Clubs Eight Clubs Five Hearts Three Clubs Five Hearts Nine Clubs Two Clubs Queen Hearts Six Clubs

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Hand2

Jack Hearts Nine Hearts Five Diamonds Three Diamonds Six Clubs King Hearts Jack Diamonds Six Diamonds King Diamonds Nine Hearts Seven Diamonds Jack Clubs Two Clubs Jack Diamonds Ace Spades Eight Diamonds Queen Clubs King Hearts Ten Hearts Jack Hearts Jack Hearts Nine Spades Two Diamonds Nine Diamonds Ten Diamonds Three Diamonds Two Spades Jack Hearts Queen Diamonds Five Hearts Ace Diamonds Six Diamonds Four Diamonds Six Spades Two Spades

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Hand3

Two Clubs Six Spades Seven Diamonds King Spades Two Spades Ten Diamonds Two Hearts Jack Hearts Nine Diamonds Two Clubs Queen Diamonds Eight Diamonds Four Hearts Ten Hearts King Hearts Six Hearts Four Clubs Six Clubs Two Clubs Jack Hearts Six Hearts Nine Hearts Seven Hearts Six Spades Five Diamonds Queen Hearts Three Hearts Ace Hearts Three Clubs Five Hearts Eight Hearts Eight Hearts Six Spades Two Hearts Six Clubs

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Hand4

Three Spades Jack Spades Six Hearts Seven Spades Ace Clubs Ace Spades Five Spades Nine Spades Six Diamonds Four Spades Five Diamonds Nine Spades Ten Spades Four Spades Nine Clubs Seven Spades Two Spades Jack Spades Jack Diamonds Five Spades King Spades Jack Diamonds Seven Spades Nine Diamonds Jack Spades Jack Clubs Queen Spades Eight Spades Jack Spades Ace Spades Ace Hearts Seven Spades Ten Diamonds King Diamonds Six Spades

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Databases On The Web Learn To Create Web Pages That Interface With Database Engines

Authors: Robert Papaj, Donald Burleson

11th Edition

1576100995, 978-1576100998

Students also viewed these Databases questions