Can someone help me with C++? I have to implement a priorityQueue Linked List in my header file. It has to work with the tests that are in the main cpp file. Can't be adjusted.
//////////////////////////////////////////
driver.cpp
//////////////////////////////////////////
#include <iostream>
#include <string>
#include "stackLL.h"
#include "queueLL.h"
#include "priorityQueueLL.h"
using namespace std;
int main()
{
//////////Test code for priority queue/////
priorityQueueLL<int> pQueue;
const int SIZE = 20;
//insert a bunch of random numbers
for (int i = 0; i < SIZE; i++)
{
pQueue.insert(rand());
}
//pull them back out..
//They must come out in order from smallest to largest
while (!pQueue.empty())
{
cout << pQueue.extractMin() << endl;
}
priorityQueueLL<string> pqs;
pqs.insert("whale");
pqs.insert("snake");
pqs.insert("buffalo");
pqs.insert("elmo");
pqs.insert("fire");
pqs.insert("waffle");
//buffalo elmo fire snake waffle whale
while (!pqs.empty())
{
cout << pqs.extractMin() << endl;
}
return 0;
}
//////////////////////////////////////////
priorityQueueLL.h (In the image)
//////////////////////////////////////////
Step by stepSolved in 2 steps with 1 images
- It can be inconvenient to build a linked chain of nodes by manually connecting them one after another. A more convenient approach would be to have a function that takes a Python list as a parameter, and generates a linked chain of nodes with the same values, and in the same order, as the values in the Python list. Define the create_node_chain (values) function which does this job. The create_node_chain (values) function takes a Python list as a parameter and returns a reference to a linked chain of nodes. Note: you can assume that the parameter list is not empty. For example: Test Result values = create_node_chain ( ['apple', 'banana', 'cherry', 'date', 'elderberry']) apple print_node_chain(values) banana if not is instance(values, Node): print("a_node must be an object of the Node class") cherry date elderberry Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %) Reset answer 1 2def create_node_chain(my_list): 3 51 6 9 10 11 13 14 15 start = tmp = Node(my_list[0]) n…arrow_forwardYour understanding of importing modules, using lists and dictionaries and creating objects from a class will be exercised in this lab. Be prepared to use your solution for the “Classes” lab (see Blackboard for the link) where you wrote the PlayingCard class. In this lab, you will have to generate a random list of PlayingCard objects for where the suit and rank combinations of each card are randomly choosen. Using this list of randomly created playing cards, you will use dictionaries and lists to store important data about these playing cards, particularly the frequency distribution of each rank-suit combination you created (e.g. like if 10 queen of hearts cards are generated and counted.) Thanks to the clearly described interface used to communicate to any PlayingCard object, specifically the get_rank() and get_suit() methods, you can just import your “Classes” lab as a module and use your previously written code! Note: You’ll definitely need to make sure your solutions work for this…arrow_forwardNeed help. Its in C++. Whats the main idea herearrow_forward
- Help me to learn. I am eager to learn Python Programming.arrow_forwardJS In this challenge, you must verify the equality of two different values given the parameters a and b. Both the value and type of the parameters need to be equal. The possible types of the given parameters are: What have you learned so far that will permit you to do two different checks (value and type) with a single statement? Implement a function that returns true if the parameters are equal, and false if they are not. Examples checkEquality(1, true) → false // A number and a boolean: the value and type are different. checkEquality(0, "0") → false // A number and a string: the type is different.arrow_forwardplease in c++ im really struggling and would appreciate the help ill give like, down below i will leave the ADT LinkedSorterLists.h and .cpp c Question: Write an implementation using the ADT LinkedSorterList (textbook code) defining a list of runner objects. Create a Runner class with two attributes one is the time (hh:mm:ss) of the Time datatype and the other is the runner's name. The Time Class has three integer attributes and stores the time in military time format (Ex. 13:45:34). Your program determines the places of the runners. 16. Running the Race Write a program that asks for the names of three runners and the time it took each of them to finish a race. The program should display who came in first, second, and third place. Input Validation: Only accept positive numbers for the times. (Gaddis T. 2018)arrow_forward
- Can you write this? Thanks! NumberList.cpp // Implementation file for the NumberList class#include <iostream> // For cout#include "NumberList.h"using namespace std; //**************************************************// displayList shows the value *// stored in each node of the linked list *// pointed to by head. *//************************************************** void NumberList::displayList() const{ListNode *nodePtr; // To move through the list // Position nodePtr at the head of the list.nodePtr = head; // While nodePtr points to a node, traverse// the list.while (nodePtr){// Display the value in this node.cout << nodePtr->value << endl; // Move to the next node.nodePtr = nodePtr->next;}} //**************************************************// The insertNode function inserts a node with *// num copied to its value member. *//************************************************** void NumberList::insertNode(int num){ListNode *newNode; // A new nodeListNode…arrow_forwardWrite a C++ program by using classes to delete duplicate elements from an array?After duplicate elements removal, sort the array in ascending order. After sorting the array, copy all sorted elements of the array1 into the array 2, then multiply values in array 1 and array2 and store it in array3.Further, you are not allowed to use for loop. You can use while loop, user define functions and multi level inheritance.arrow_forwardcan someone help me with this in C++ (not Java) create a program that reads in two matrices from two different text files. Should use a singly or double linked list to store the two matrices and perform the following operations on them: - Add, Subtract, Mulitply, Transpose, and Determinant Requirements: Use singly or doubly linked list date structures only: - No other library methods or existing collection framework. - No use of Array, ArrayList, List, or Vectors for storing. - No two-dimensional arrays. - Input files can only be read Exactly Once for all operations. For the determinant operation, you may augment your linked list node to retain row/column id and employ recursion to directly implement the standard method for computing determinant of a matrix. You are encouraged to design your own node representation (e.g., each node element has two pointers: one to its next right and another to its next bottom element that facilitate both horizontal and vertical traversals like one gets…arrow_forward
- This is a free form programming assignment where you are: Required to create a simple phone book application Asked to make a choice of appropriate data structure and implementation. Defend your selection and explain the efficiency of your program using Big(O) notation.You do not need to create data structures from scratch. You are free to use datastructures available in the standard template C++ library. For example std::stack<int> orstd::set<int> , std::maps<int,int>, etc. You have familiarity with these from your CodeStep by Step labs. You are not permitted to use simple arrays. SpecificationsCreate a phone book program that stores and manages contact information.Contact information is name and corresponding phone number. The program reads thisinformation for multiple contacts from a data file “contacts.txt” and saves them in asuitable data structure. Once the data is stored, it allows the user to display all contacts,add a single contact, remove a contact,…arrow_forwardNeed help with this Java review If you can also send a screenshot will be helpful to understan Objective: The purpose of this lab exercise is to create a Singly Linked List data structure . Please note that the underlying implementation should follow with the descriptions listed below. Instructions : Create the following Linked List Data Structure in your single package and use "for loops" for your repetitive tasks. Task Check List ONLY "for" loops should be used within the data structure class. Names of identifiers MUST match the names listed in the description below. Deductions otherwise. Description The internal structure of this Linked List is a singly linked Node data structure and should have at a minimum the following specifications: data fields: The data fields to declare are private and you will keep track of the size of the list with the variable size and the start of the list with the reference variable data. first is a reference variable for the first Node in…arrow_forwardQuestion 1. Load the NumPy library using the standard abbreviation np.arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY