Simulation of queues, Data Structure & Algorithms

Assignment Help:

Simulation is the process of making an abstract model of a real world situation in order to be aware of the effect of modifications and alterations and the effect of introducing number of strategies on the situation. The simulation program must necessity schedule the events in the simulation so the activities occur in the correct time sequence.  Take an example, suppose a person visit an outlet at time 't1' to deposit the bill of his cell phone. The transaction can be expected to take a certain period of the time 't2' to complete. If any of the service window is free or not busy, then the person can immediately deposit the bill in time (t1+t2) spending the exact time required to deposit the bill. If none of the service window is free and there is long queue waiting at each window. Then the person joins the smallest queue and waits until all previous people deposits their bills and leaves the line. In such case, the time spends by person in the bill office in t2+time spends in waiting. These kinds of problem are solved by writing a program to simulate the actions of the persons. The various service windows can be represented by different queues and each person waiting in that line is represented by the node in that particular queue. The node at the front of the queue represents the person currently taking service at the window. We can define  various  events related  with  the  process  like  arrival  of  a  person and departure of a person etc.

When a departure node is removed from the event list when the person leaves, the amount of time spent by  the  departing  person  is  computed  and  added  to  a  total  and  the  node representing the person is separated from the front of the queue. After a node has been removed from the front of the queue, the next person in the queue becomes the first to be service window and a departure node is added to the event list. At the end of simulation, when the event list gets empty, the total sum will be divided by the number of persons to obtain the average time spent by a person.

 

 


Related Discussions:- Simulation of queues

If else, design algorithm and flow chart that computes the absolute differe...

design algorithm and flow chart that computes the absolute difference of two values x and y

Sorting, how to do a merge sorting

how to do a merge sorting

Interest, I=PR/12 numbers of years : Interest Rate up to 1 years : 5...

I=PR/12 numbers of years : Interest Rate up to 1 years : 5.50 Up to 5 years : 6.50 More than 5 year : 6.75 please design an algorithm based on the above information

Operations on b-trees, Operations on B-Trees Given are various operatio...

Operations on B-Trees Given are various operations which can be performed on B-Trees: Search Create Insert B-Tree does effort to minimize disk access and t

Write an algorithm to measure daily temperatures, A geography class decide ...

A geography class decide to measure daily temperatures and hours of sunshine each day over a 12 month period (365 days) Write an algorithm, using a flowchart that inputs tempera

Draws a rectangular grid algorithms, Prepare a GUI called Hotplate GUI that...

Prepare a GUI called Hotplate GUI that holds a central panel that draws a rectangular grid that represents Element objects which should be held in a 2-dimensional array. The applic

Multidimensional array in one dimensional array, Q. By giving an example sh...

Q. By giving an example show how multidimensional array can be represented in one the dimensional array.

If, 1. Start 2. Get h 3. If h T=288.15+(h*-0.0065) 4. else if h T=2...

1. Start 2. Get h 3. If h T=288.15+(h*-0.0065) 4. else if h T=216.65 5. else if h T=216.65+(h*0.001) 6. else if h T=228.65+(h*0.0028) 7. else if h T=270.65 8.

Program segment for deletion of any element from the queue, Program segment...

Program segment for deletion of any element from the queue delete() { int delvalue = 0; if (front == NULL) printf("Queue Empty"); { delvalue = front->value;

Write Your Message!

Captcha
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