Deletion algorithm for dequeue, Data Structure & Algorithms

Assignment Help:

Deletion Algorithm for dequeue

Step 1: [check for underflow]
  If front = 0 and rear = 0
  Output "underflow" and return

Step 2: [delete element at front end]
  If front > 0
  Value = q [front]
  Return [value]

Step 3: [check queue for empty]
  If front = rear
  Front = rear = 0
  Else
  Front = front +1

Step 4: [delete element at the rear end]
  If rear > 0
  Value = Q [rear]
  Return (rear)

Step 5: [check queue for empty]
  If front = rear
  Front = rear = 0
  Else
  Rear = rear - 1

Step 6:  Return 


Related Discussions:- Deletion algorithm for dequeue

Operating system, discuss the operating system under the following: MONOLIT...

discuss the operating system under the following: MONOLITHIC SYSTEM,LAYER SYSTEM AND VIRTUAL MACHINES

Boundary tag method in context of dynamic memory management, Q. How can we ...

Q. How can we free the memory by using Boundary tag method in the context of Dynamic memory management?

Algorithm to build a binary tree , Q. Give the algorithm to build a binary ...

Q. Give the algorithm to build a binary tree where the yields of preorder and post order traversal are given to us.

Array implementation of lists, In the array implementation of the lists, we...

In the array implementation of the lists, we will use the array to hold the entries and a separate counter to keep track of the number of positions are occupied. A structure will b

Algo for quicksort, Easy algorithm for beginner for quicksort with explanat...

Easy algorithm for beginner for quicksort with explanation

Basic organization of computer system, what happen''s in my computer when ...

what happen''s in my computer when i input any passage

Linked list, Write a program for reversing the Linked list

Write a program for reversing the Linked list

Cache simulator, how to design a cache simulator with 4-way set associative...

how to design a cache simulator with 4-way set associative cache

Dqueue, how can i delete from deque while deletion is restricted from one e...

how can i delete from deque while deletion is restricted from one end

Sort 5, The number of interchanges needed to sort 5, 1, 6, 2 4 in ascending...

The number of interchanges needed to sort 5, 1, 6, 2 4 in ascending order using Bubble Sort is 5

5/11/2013 1:28:05 AM

Thanks for suggesting me this answer, appreciate your knowledge.

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