Reference no: EM13161785
data structures class this project will give you an introduction. There are two important data structures that you will learn and use. The first is a stack, it is a LIFO (Last In First Out) structure. You can think of it like a a stack of plates in your cabinet. You pile plates on top of each other when you put them away and you take a plate from the top of the pile when you need to use one. This functionality is called push (add to the top of the stack) and pop ( remove from the top of stack). There is one last function that most stacks have. This function is called peek because it will allow you to see what is at the top of the stack without removing it.
The other popular data structure is called a queue. The queue is a FIFO (First In First Out) data structure and you can think of it like standing in line at Disneyland. If you are fortunate enough to be first in line then you are the first person to get on the ride. You will see the stack and the queue all over computers if you study operating systems. The stack is used to store and keep track of variables and the queue is used to store data that is waiting to be processed. This is just to name a couple. In the operating system tasks that are being scheduled to run are put into the queue. There is a slight difference in that many of these queues are called priority queues in that each taks added to the queue is assigned a priority. The higher the priority a task has, the closer it gets to the front of the queue.
Your task is to create a priority queue class calle priQueue that is derived from the vector class. Your class should be constructed as a template class so that the type of data the queue operates on can easily be changed:
priQueue iQueue; // holds ints
priQueue sQueue; // holds string.
Your priority queue should be sorted by priority based on a value from 1 to 10. If a number is assigned that is outside the range of 1 to 10 you should give the element a value of 5. What this means is that each time an element is added to the queue it should be put in order by priority. If multiple elements are given the same priority their position relative to each other is unimportant as long as they are prioritized relative to other elements in the queue.
Your priQueue should have the following functionallity:
- enqueue - Add an element to the queue
- dequeue - Remove element from the front of the queue
- peek - Return value at front of queue do not remove it
- size - Returns the number of items in the queue.
Specifics
You should create a struct called qElem that will hold both the priority of the element and the data to be put in the queue. The struct should also be of template type so that the value it holds can be of any type. The priority variable type should be an int.
The priQueue class should be derived from vector and should also be a template class so that it can operate on any type. The enque function should be adding a qElem struct so that the data and the prority are coupled. This needs to be done so that the data and priority are related for sorting. Here is an example:
priQueue que;;
que.enqueue("Hello", 3);
que.enqueue("Goodbye", 9); // You are passing a string an an int but you should store a qElem struct.
string s = que.dequeue();
The string s at this point should hold "Goodbye" even though it was put in last because it has a higher priority.
Sorting your queue. You are to create your own sort functionality. Pick any sort that you would like but the bubble sort might be the easiest to implement.
Compute the union and intersection of two sets
: How can you compute the union and intersectio of two sets, using some of the methods that the set interfce provides? hint: your code should not be bigger than four lines
|
Public boolean chackanagram
: write the anagramList() chackanagram. checkAnagram returns true if its two Word parameters have original words that are nagrams. If not, checkAnagram returns false. use the ethod header below to write checkanagram. Assume that all Word methods work a..
|
50 element array of integers with random numbers
: write a java code to instantiate and initialize a 50 element array of integers with random numbers in the range of 45 through 256 inclusive.
|
Develop a web-scraping program
: Develop a web-scraping program that can obtain the html contents from a URL and parse the contents to extract data to be used as the source data for a system integration document. This needs to be done in Visual Studio, preferrably VB, C#, or C++.
|
Data structures class
: data structures class this project will give you an introduction. There are two important data structures that you will learn and use. The first is a stack, it is a LIFO (Last In First Out) structure. You can think of it like a a stack of plates in y..
|
Design a prgram using python
: Design a prgram USING PYTHON that students can use to calculate what score they need on final exam to get a certan final grade for a course.
|
Indicates that the student id is abc54301
: Indicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each corre..
|
Write java code to read integers from an input file
: write java code to read integers from an input file and write only the odd numbers to an output file. the two file names will be provided on the command line as the input file followed by the output file.
|
List all the registration system stakeholders
: 1. List all the registration system stakeholders. How is each group affected?
|