Write a program that simulates the heap

Assignment Help Data Structure & Algorithms
Reference no: EM132106340

this program is in C++

please use pointers and -> . and also please it should be a working program

Question: Write a program that simulates the "heap" using a linked list. This program should start off by taking one node of size 9096 KB. You can assume that all request to the heap are in KB.

The user should request a size of memory from the system, then the system should find memory that can be allocated based on the user's request.

If memory cannot be allocated based on user's request, send the appropriate message. Memory should be returned back to teh system after it is freed. Things to remember, you should write a user interface that has menu commands to request memory, free memory and display used memory.

Sample Memory request adn heap after request.

Heap: Node 1: Start Address: 0 Size: 9096 KB Used Memory: NULL User Request: 10 User Request: 20 User Request: 50 User Request: 10 Heap: Node 1: Start Address: 80 Size: 9006 KB Used memory: Node 1: Start Address: 0 Size 10 KB Used memory: Node 2: Start Address: 10 Size 20 KB Used memory: Node 3: Start Address: 30 Size 50 KB Used memory: Node 4: Start Address: 80 Size 10 KB Free Memory Start Address: 10 Heap Node 1: Start Address: 10 Size : 20 KB Heap Node 2: Start Address 80: Size 9006 KB Used memory: Node 1: Start Address: 0 Size 10 KB Used memory: Node 2: Start Address: 30 Size 50 KB Used memory: Node 3: Start Address: 80 Size 10 KB Free Memory Start Address: 30 Heap Node 1: Start Address: 10 Size : 70 KB Heap Node 2: Start Address 80: Size 9006 KB Used memory: Node 1: Start Address: 0 Size 10 KB Used memory: Node 2: Start Address: 80 Size 10 KB

Reference no: EM132106340

Questions Cloud

Extreme moodiness fluctuating between depression : Nick is an adolescent boy who has been very difficult for his parents. He experiences extreme moodiness fluctuating between depression and intense feeling
Does having a mental problem and being addicted : Does having a mental problem and being addicted make you a higher relapse risk?
If faced with a values conflict with a client : If faced with a values conflict with a client, how would you go about trying to resolve it? and which conflicting values might you find most difficult
Chemical dependency counselor : What values would be important to have as a human service worker or chemical dependency counselor? and why?
Write a program that simulates the heap : The user should request a size of memory from the system, then the system should find memory that can be allocated based on the user's request.
How to the operating systems schedule all the processes : How to the Operating Systems schedule all the processes on a multiprocessor or multicore environment.
Accompanied with a sense of intensity : Enlightenment is accompanied with a sense of intensity, a feeling of clarity, a sense of unity, and a feeling of surrender.
What would be the actual cpi : If the program is executed on the MIPS pipeline, what would be the actual CPI? And without forwarding, what would be the actual CPI?
Helping someone who has suffered a loss : What do you see as being most important in helping someone who has suffered a loss, needing another perspective please?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Find the shortest paths from s to all the other nodes

Find the Minimum-Cost Spanning Trees for the above graph using the following algorithms.

  Write a method that removes all duplicates in an array

Write a method that removes all duplicates in an array A of N items. Return the number of items that remain in A. Your method must run in O(N log N).

  Eliminate every other integer beginning with the integer

the Collections class which has an algorithm called rotate(List list, int distance) which can be used to rotate a list left or right. use to eliminate every other Integer beginning with the Integer in the second position. Remember that if you rem..

  Calculate the diffie-hellman key values

Calculate the Diffie-Hellman key values. Calculate values for both keys (secret key a and secret key b). You must show your work for full credit.This includes the calculations each person performs to calculate and verify the values.

  Execute the given stack operation

For each part of this problem, assume the "before" values when the given instruction is executed. Give the requested "after" values.

  Design and code your own lifo stack using single liked list

Design and code your own LIFO Stack using single liked list to hold a list of integers. Use the C++ "struct" structure to create your SLL nodes. Node position numbering should start with one.

  Given list of n positive integer divide list into subsists

Given a list of n positive integers (n even), divide the list into two subsists such that the difference between the sums of the integers in the two subsists is

  Search a graph for a vertex that stores a given data item

Search a graph for a vertex that stores a given data item, and retrieve information about that item and/or update the information.

  Write steps to prove the correctness of huffman algorithm

Prove the correctness of Huffman's algorithm by expanding the following steps. Show that the two least frequent characters must be the two deepest nodes.

  Write algorithm that deletes a node from binary search tree

Write an algorithm that deletes a node from a binary search tree considering all possible cases. Analyze your algorithm and show results using order notation.

  Explain an application level protocol

Create and explain an application level protocol to be used in an automatic teller machine and a bank's centralized computer. Your protocol should permit a user's card and password to be verified,

  Why must we check before the call to preorder

Why must we check before the call to preorder when implementing as a method, whereas we could check inside the call when implementing as a function?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd