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

Determine the importance of array, Determine the importance of array Ar...

Determine the importance of array Arrays are significant since they allow many values to be stored in a single data structure whereas providing very fast access to each value.

Demonstration of polynomial using linked list, Demonstration of Polynomial ...

Demonstration of Polynomial using Linked List # include # include Struct link { Char sign; intcoef; int expo; struct link *next; }; Typedefstruct link

Depth First Search Through Un-weighted Connected Graph , Q. Write down the ...

Q. Write down the algorithm which does depth first search through an un-weighted connected graph. In an un-weighted graph, would breadth first search or depth first search or neith

Fifo, give any example of page replacement using fifo and use your own refe...

give any example of page replacement using fifo and use your own reference string

Technique for direct search, Technique for direct search is    Hashing ...

Technique for direct search is    Hashing is the used for direct search.

Post order traversal, Post order traversal: The children of node are vi...

Post order traversal: The children of node are visited before the node itself; the root is visited last. Each node is visited after its descendents are visited. Algorithm fo

Define different types of sparse matrix, Q1. Define a sparse matrix. Explai...

Q1. Define a sparse matrix. Explain different types of sparse matrices? Evaluate the method to calculate address of any element a jk of a matrix stored in memory. Q2. A linear

State about the pseudocode, State the Introduction to pseudocode No spe...

State the Introduction to pseudocode No specific programming language is referred to; development of algorithms by using pseudocode uses generic descriptions of branching, loop

Define stack lifo, A stack is a last in, first out (LIFO) abstract data typ...

A stack is a last in, first out (LIFO) abstract data type and sequential data structure. A stack may have any abstract data type as a component, but is characterized by two fundame

Find longest repeat prefix of string - linear time algorithm, 1. A string s...

1. A string s is said to be periodic with a period α, if s is α k for some k > 2. (Note that α k is the string formed by concatenating k times.) A DNA sequence s is called a tand

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