team 6

10
deque And Its Applications B.Manoj - 13MX27 M.Parthiban - 13MX32 R.Sathasivam - 13MX41 G.Sivanantham - 13MX45 N.TamilArasan – 13MX49

Upload: sathasivam-r

Post on 02-Aug-2015

19 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Team 6

deque And Its Applications

B.Manoj - 13MX27

M.Parthiban - 13MX32

R.Sathasivam - 13MX41

G.Sivanantham - 13MX45

N.TamilArasan – 13MX49

Page 2: Team 6

What is deque ? A double-ended queue is an abstract data type

that generalizes a queue, for which elements can

be added to or removed from either the front or

rear.

It is also often called a head-tail linked list.

Page 3: Team 6

Types

Input-restricted deque

Deletion can be made from both ends , but

Insertion can be made at one end only.

Output-restricted deque

Insertion can be made at both ends , but

Deletion can be made from one end only.

Page 4: Team 6

Operations

pushRear() - Insert element at back

pushFront() - Insert element at front

popRear() - Remove last element

popFront() - Remove first element

isEmpty() – Checks whether the queue

is empty or not.

Page 5: Team 6

Example of deque Operation

Operation deque Contents Return Value

isEmpty() [] True

pushFront(‘a’) [‘a’]

pushFront(‘b’) [‘b’ , ‘a’]

pushRear(‘c’) [‘b’ , ‘a’ , ‘c’]

popFront() [‘a’ , ‘c’] ‘b’

isEmpty() [‘a’ , ‘c’] False

popRear() [‘a’] ‘c’

Page 6: Team 6

deque Applications

Palindrome CheckerMadam, Radar, Malayalam are some examples for palindrome

Page 7: Team 6

deque ApplicationsA-Steal job scheduling algorithm

– The A-Steal algorithm implements task

scheduling for several

processors(multiprocessor scheduling).

– The processor gets the first element from the

deque.

– When one of the processor completes

execution of its own threads it can steal a

thread from another processor.

– It gets the last element from the deque of

another processor and executes it.

Page 8: Team 6

deque Applications

Undo - Redo operation in software applications

Page 9: Team 6

Any Query ?

Page 10: Team 6

Thank You