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

Linear node is given by means of pointer, A linear collection of data eleme...

A linear collection of data elements where the linear node is given by means of pointer is known as Linked list

Various passes of bubble sort, Q. Show the various passes of bubble sort on...

Q. Show the various passes of bubble sort on the unsorted given list 11, 15, 2, 13, 6           Ans: The given data is as follows:- Pass 1:-     11   15   2     13

Diophantine Equations, Implement algorithm to solve 5-1 fifth order equati...

Implement algorithm to solve 5-1 fifth order equation given.

Doubly linked list having n nodes, The time required to delete a node x fro...

The time required to delete a node x from a doubly linked list having n nodes is O (1)

Dynamic memory management, How memory is freed using Boundary tag method in...

How memory is freed using Boundary tag method in the context of Dynamic memory management? Boundary Tag Method to free Memory To delete an arbitrary block from the free li

Trees, What is AVL Tree? Describe the method of Deletion of a node from and...

What is AVL Tree? Describe the method of Deletion of a node from and AVL Tree ?

State algorithm to insert node p at the end of a linked list, Algo rithm t...

Algo rithm to Insert a Node p at the End of a Linked List is explained below Step1:   [check for space] If new1= NULL output "OVERFLOW" And exit Step2:   [Allocate fr

Row major representation, Row Major Representation In memory the primar...

Row Major Representation In memory the primary method of representing two-dimensional array is the row major representation. Under this representation, the primary row of the a

Circular doubly link list, what is circular doubly link list?write down the...

what is circular doubly link list?write down the algorithm for insertion of elements in circular doubly link list

Explain time complexity, Time Complexity, Big O notation The amount of ...

Time Complexity, Big O notation The amount of time needed by an algorithm to run to its completion is referred as time complexity. The asymptotic running time of an algorithm i

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