card project

Encerrado Postado há 6 anos Pago na entrega
Encerrado Pago na entrega

Project description:

The program should have a class template that is the implementation of a priority queue. The implementation must be based on building and maintaining heaps based on “highest priorities”, which may be minimum values or maximum values. A single enqueue and a single dequeue function will use a custom comparator to add and remove items from the underlying heap, based on whether a max queue or a min queue is declared. The functionality of the priority queue will be demonstrated by storing instances of a custom class in both decreasing and increasing order.

Requirements:

1. Your program must be split into 4 files. There will be a class template, a separate interface and implementation file for a custom class, and a driver file. The requirements for these are specified below:

a) The PriorityQueue class template– This class represents a priority queue implemented as a binary heap. It has two type parameters: 1) The type of the element stored in the heap; 2) A comparator class.

• Since this is a class template, it will be implemented in a single file which must be named priorityqueue.h

• The class must be named PriorityQueue

• You should implement the following member functions in the class

o A constructor – Resizes the vector representing the heap to hold 50 items.

o top – Returns the highest priority item in the heap. Does not change the heap.

o dequeue – Has a comparator parameter. Removes the highest priority item in the heap.

o enqueue – Has two parameters: 1) the item to be enqueued; 2) the comparator. Enqueues the item and places it in the heap in priority order.

o print – Displays the items in the heap, from index 0 through index size-1.

o heapUp (private) – Has an index and a comparator parameter and percolates the item up based on its priority.

o heapDown (private) – Has an index and a comparator parameter and percolates the item down based on its priority.

b) Comparators - There will be two templated class comparators each of which takes a type parameter: one to compare if items are less than or equal to (<=) each other, and one to compare if they’re greater than or equal to (>=). Each of these classes will have a single, public, bool function that returns the result of the above comparisons for two objects of the same type. This function will have the same name in both classes. These functions will be used in the declaration of the priority queues (i.e., as type parameters), and will be defined in the file priorityqueue.h. (Fig 1.24 in the textbook shows a custom comparator class).

c) The Card class – This class will be a modified version of the Card class used in Project 4, and will be used to demonstrate the generic nature of the priority queue (its ability to store objects of any type).

• Both the interface file (card.h) and the implementation file ([url removed, login to view]) from that project will be used

• The following changes are to be made to the Card class

o The <= and >= operators must be overloaded (they may replace < and > overload in that class)

o The order (lowest to highest) shall be Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King. The cardFace values of these cards shall be 1 through 13 respectively.

o The ostream << overload must output cardFace (rather than pointValue of Project 4). The member

pointValue will NOT be used in this project

d) A driver, or client, file that

• Must be named [url removed, login to view]

• Instantiates both a min priority queue and a max priority queue.

• Instantiates an array of the 13 cards in the Spades suit

• Shuffles the cards array using std::random_shuffle()

• Enqueues the first 7 cards in the max priority queue and displays the heap’s contents after each enqueue

Programação C Programação C# Programação C++ Java Arquitetura de software

ID do Projeto: #15642317

Sobre o projeto

9 propostas Projeto remoto Ativo em há 6 anos

9 freelancers estão ofertando em média $46 nesse trabalho

it2051229

I went through the requirements and I would like to do this project if given the opportunity. I have done priority queue before. Let me know if you are interested. Relevant Skills and Experience C++ Programming, Data Mais

$30 USD em 1 dia
(1512 Comentários)
7.9
liangjongai

Hi! I'm interesting your project very well. I am mastering c++ and I'm a good algorithmer. And also I have many experience and good skill about data structure. Let's go ahead with me Stay tuned, I'm still working on Mais

$30 USD em 1 dia
(256 Comentários)
7.1
hbxfnzwpf

I am very proficient in c and c++. I have 16 years c++ developing experience now, and have worked for more than 7 years. My work is online game developing, and mainly focus on server side, using c++ under Linux environ Mais

$100 USD em 1 dia
(148 Comentários)
7.0
AhmedLabib93

Hello I'm expert java developer with experience in object oriented, data structure, swing, javafx and more advanced concepts. I can help you to finish this project with great quality. Regards Relevant Skills and Exper Mais

$40 USD in 2 dias
(397 Comentários)
6.6
wangbeizou

Hello. How are you today. I have read and understood this task. Relevant Skills and Experience I have a lots of experience and very good knowledge of Data structures, Algorithms Design, Computer Architecture. And I'm Mais

$40 USD em 1 dia
(189 Comentários)
6.5
Programmer59

Hello Sir i will do your work and i will assure you a quality work if tiy go with us . Relevant Skills and Experience i am expert in C , C++ , C# , JAVA Proposed Milestones $25 USD - work

$25 USD em 1 dia
(56 Comentários)
5.9
harshdaga

Hi, I've got quite some experience with C++ and I'm sure I can help you out with your project. May I get some more details over the chat? Relevant Skills and Experience C++ Proposed Milestones $50 USD - Completion

$50 USD em 1 dia
(85 Comentários)
5.5
usamamw141

A proposal has not yet been provided

$50 USD in 3 dias
(101 Comentários)
5.5