Abstract data type- queue, Data Structure & Algorithms

Assignment Help:

A significant aspect of Abstract Data Types is that they explain the properties of a data structure without specifying the details of its implementation. The properties might be implemented independent of any implementation in any programming language.

Queue is a set of elements, or items, for which the given operations are defined:

createQueue(Q) : It create an empty queue Q;

isEmpty(Q): is a boolean type predicate which returns ''true'' if Q exists and is empty, and returns ''false'' otherwise;

addQueue(Q,item) adds the given item to the queue Q; and deleteQueue (Q, item) : delete an item through the queue Q;

next(Q) eliminate the least recently added item which remains in the queue Q, & returns it as the value of the function;

isEmpty (createQueue(Q)) : It is always true, and deleteQueue(createQueue(Q)) : error

The primitive isEmpty(Q) is needed to know whether the queue is empty or not, Since calling next on an empty queue must cause an error. Like stack, the situation might be such while the queue is "full" in the case of a finite queue. But we ignore defining this here as it would based on the real length of the Queue defined in a particular problem.

The word "queue" is like the queue of customers at counter for any service, wherein customers are dealt along with in the order where they arrives i.e. first in first out (FIFO) order. In most of the cases, in the queue the first customer is the first to be served.

As pointed out previous, Abstract Data Types define the properties of a structure without indicating an implementation in any way. Therefore, an algorithm that works with a "queue" data structure will work wherever this is implemented. Usually different implementations are of different efficiencies.


Related Discussions:- Abstract data type- queue

Drawback of sequential file, Following are some of the drawback of sequenti...

Following are some of the drawback of sequential file organisation: Updates are not simply accommodated. By definition, random access is impossible. All records should be

Write an algorithm to display this repeated calculation, The following form...

The following formula is used to calculate n: n = x * x/(1 - x) . Value x = 0 is used to stop algorithm. Calculation is repeated using values of x until value x = 0 is input. There

Define a tree and list its properties, QUESTION (a) Define a tree and l...

QUESTION (a) Define a tree and list its properties. (b) By showing all your workings, draw the spanning tree for the following graph based on the Breadth-First-Search algori

Implementation of stack using linked lists, In the last subsection, we have...

In the last subsection, we have implemented a stack by using an array. While a stack is implemented by using arrays, it suffers from the basic restriction of an array - i.e., its s

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.

What is an unreachable code assertion, What is an unreachable code assertio...

What is an unreachable code assertion An unreachable code assertion can be placed at the default case; if it's every executed, then program is in an erroneous state. A loop in

If-then-else statements, In this example, suppose the statements are simple...

In this example, suppose the statements are simple unless illustrious otherwise. if-then-else statements if (cond) { sequence of statements 1 } else { sequence of st

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

Which data structure is used for implementing recursion, Which data structu...

Which data structure is used for implementing recursion Stack.

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