Create a stack in c++ for double numbers called xStack

Completed Posted 5 years ago Paid on delivery
Completed Paid on delivery

Tasks:

1. Design a stack for double numbers called xStack, which, besides push, pop, isEmpty, peek methods, it has methods for returning the minimum element (min) and the maximum element (max), which should operate in O(1) time, meaning you can't obtain the minimum/maximum by traversing any stack array. xStack should be built using the template class Stack uploaded .

2. Finding the path to the room using the Stack data structure.

A building is represented though a N*M binary matrix of blocks (representing corridors/ stairs, walls and doors). A person, positioned initially at coordinates (0,0) in the building matrix wants to find the door to his room , which has a numerical code (other than 0 and 1): e.g. 101. In the building matrix, we can have 3 types of values: room codes, 0 - means corridors/ stairs, 1 - means walls. A person can go through corridors and stairs till his room . The person can move in any direction (not diagonally) to any matrix block provided the block is not a dead end (walls and doors different from the one he/she is looking for). The task is to check if any path exists so that the person can reach the room and print the path, using the stack data structure.

The input will be 3 building matrices and the code of person's room: the first 2 letters represent the building and the other 3 represent the numerical code inside the building, e.g. MT101.

Example of building matrix for MT building:

MTbuilding[4][5] = {

{0, 104, 0, 0, 1},

{0, 0, 0, 1, 0},

{1, 0, 1, 101, 102},

{0, 0, 0, 0, 0}

}

Example of output, when the person searches for MT101:

Path Found!

The path can be: (0, 0) -> (1, 0) -> (1, 1) -> (2, 1) -> (3, 1) -> (3, 2) -> (3, 3) -> (2, 3)

3. We want to stock all the available rooms in the campus. The rooms are stocked in a priority queue. Implement a template class called PriorityQueue using the xStack class: the rooms are added to the queue in the classical way, at the end of the queue, but when deleting them, the room which is the closest to the building entrance door is selected. In order to calculate the distance between a room and the building entrance door, the distance formula between 2 points is used. The building entrance door has coordinates (0,0). The room doors have coordinates equal to the line and the column in the matrix building.

We need the source files (.cpp and .h) .

A README file in which you will specify all the functional sections of the project, together with instructions for the user; We need a description with every code line of what it does.

Thank you !

C Programming C# Programming C++ Programming Java Verilog / VHDL

Project ID: #19038972

About the project

8 proposals Remote project Active 5 years ago

Awarded to:

naryl

Hello. The first part (O(1) min/max) can be done by either caching min and max values after every push/pop or by maintaining a secondary internal ordering (which can also be used for the third task's priority queue). T More

$60 USD in 1 day
(33 Reviews)
5.5

8 freelancers are bidding on average $52 for this job

idleswell

Hello, I have 25 years experience programming in C++. I will complete these 3 exercises. A milestone payment for the full budget for this project must be deposited with this site before your offer can be accepte More

$137 USD in 3 days
(70 Reviews)
5.1
msohaibakram

Dear Client, I am highly experienced with C++ development. I have experienc with many projects. Kindly contact me. Thanks

$90 USD in 1 day
(0 Reviews)
0.0
Svetrivel2006

Total 18+ years of experience and relevant 9+ years of experience. Expert in data structures, C. worked in embedded domain using C and C++. Created unicode editor for different languages. Have experience in STL usage More

$35 USD in 4 days
(0 Reviews)
0.0
fahadhassan0206

Hi I have over 4 years of experience in programming. I can do ooad projects with the data structures and database. Send me your requirements and i will provide quality work on time. Regards Fahad Hassan

$25 USD in 1 day
(0 Reviews)
0.0