in the worst casethe hole must be pushed from the root to leaf node each iteration of the loop makes at most two object comparisons and moves the hole down one level notes thereforethe running time of the dequeuemin operation is log ( (log )where count is the number of items in the heap if ( and ( )the dequeuemin operation is simply (log nin the worst case task discuss the uses of binary heaps applications of heaps the main applications of heaps are discrete event simulation implementation discrete event simulation one of the most important applications of priority queues is in discrete event simulation simulation is tool which is used to study the behavior of complex systems the first step in simulation is modeling you construct mathematical model of the system wish to study then you write computer program to evaluate the model the systems studied using discrete event simulation have the following characteristicsthe system has state which evolves or changes with time changes in state occur at distinct points in simulation time state change moves the system from one state to another instantaneously state changes are called events examplesuppose wish to study the service received by customers in bank suppose single teller is serving customers if the teller is not busy when customer arrives at the bankthe that customer is immediately served on the other handif the teller is busy when another customer arrivesthat customer joins queue and waits to be served you can model this system as discrete event process as shown in figure the state of the system is characterized by the state of the server (the teller)which is either busy or idleand by the number of customers in the queue the events which cause state changes are the arrival of customer and the departure of customer figure simple queueing system customers departing customer arriving customer queue server if the server is idle when customer arrivesthe server immediately begins to serve the customer and therefore changes its state to busy if the server is busy when customer arrivesthat customer joins the queue lovely professional university