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)
//////////////////////////////////////////
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 1 images
- please 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_forwardCan 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_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_forwardIs there a way to optimize the following multithreaded quick sort algorithm, in C? I am looking for suggestions to make it run faster. I am trying to get closer to the qsort function's time. I don't want anything too complicated, like thread pooling. Here is the code: #include <stdio.h>#include <stdlib.h>#include <errno.h>#include <string.h>#include <pthread.h>#include <time.h>#define SORT_THRESHOLD 40typedef struct _sortParams {char** array;int left;int right;int* threadsLeft; // A counter to keep track of how many more threads are available to be created.pthread_mutex_t* mutex;} SortParams;static int maximumThreads; /* maximum # of threads to be used */static void insertSort(char** array, int left, int right) {int i, j;for (i = left + 1; i <= right; i++) {char* pivot = array[i];j = i - 1;while (j >= left && (strcmp(array[j], pivot) > 0)) {array[j + 1] = array[j];j--;}array[j + 1] = pivot;}}/*** This function uses a mutex to…arrow_forward
- I was hoping I could get help in describing the mountainarrow_forwardC++ Attached is the questionarrow_forwardCould I get an example of a program writen in C that uses qsort() to sort its command line vector argv by the length of the strings? This is part of my first project and I don't understand pointers very well. If you have a video on how it is done that would work too. I looked at the meterial provided to me and I still cant rap my head around it. If this is to big of a question if you could baby step me through how pointers work that would be a great help. Thank youarrow_forward
- in c++ codearrow_forwardImplement a class representing a circular sorted linked list. The class must have the following requirements: The linked list and the nodes must be implemented as C++ templates First must point to the largest value in the list It must include a constructor, a destructor, a copy constructor and an operator= It must include functions to insert a given item, delete a given item, search for a given item, check if the list is empty, return the length of the list and print the list (from smallest to largest) Hint: Use the menu-driven program of the linked list to test all the functions in your class. Screenshot the output and make comments on each area on the program.arrow_forwardWrite a function mode (numlist) that takes a single argument numlist (a non-empty list of numbers), and returns the sorted list of numbers which appear with the highest frequency in numlist (i.e. the mode, except that we want to be able to deal with the possibility of there being multiple mode values, and hence use a list ... and sort the mode values while we are at it ... obviously). For example: >>> mode ([2, 0, 1, 0, 2]) [0, 2] >>> mode([5, 1, 1, 5, 1]) [1] >>> mode ([4.0]) [4.0]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