faqts : Computers : Programming : Algorithms : Datastructure : Queue : Dequeue

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

38 of 57 people (67%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

Datastructure: Queue: Dequeue: Definition: What is a dequeue?

Dec 23rd, 2004 11:21
Knud van Eeden, ro bo,


----------------------------------------------------------------------
--- Knud van Eeden --- 25 October 2003 - 11:00 am --------------------

Datastructure: Queue: Dequeue: Definition: What is a dequeue?

---

Dequeue = 'D'ouble-'e'nded queue.

---

A dequeue is a structure in which you can store data.

It is one of the simplest (linear) structures for storing available.

---

To add data you store it on either side of this structure.

To remove data you remove it from either side of this structure.

(The common thing here is thus you only touch the 'sides' of the
 structure, instead of also adding, removing or getting data from the
 'interior' of the structure.
 A stack is still simpler, there any 'one sided' structure will do.
 So in general any 'twosided' structure in which you can store will do.
 If you remove only from one side it is a stack.
 If you remove from one side and add to the other side it is queue.
 If you remove and add from both sides it is a dequeue).

---

A dequeue is a combination of a stack and a queue.

---

A dequeue is a queue in which the contents may be changed by adding or
removing items at either end.

---

Using a string as a dequeue:

One of the most simple structures to use as a dequeue is a string.

To store data you put it on or the left or the right side of the 
string.

To remove data you remove it from or the left or the right side of the 
string.

---

original:

  "a b c d e f g"

---

adding:

  "z a b c d e f g"

or also

  "a b c d e f g z"

---

removing:

  "b c d e f g"

or also

  "a b c d e f"

---

Using a file as a dequeue:

Another possibility to store the information is using a file.

To add new information (e.g. lines) you put it in the top or bottom of
the file.

To remove information (e.g. lines) you remove it from the top or bottom
of the file.

  a

  b

  c

  d

  e

  f

  g

---

Using a computer memory as a dequeue:

Other possibilities to store the information is computer memory.

To add new information (e.g. a variable) you put it in the top or
bottom of the memory range.

To remove information (e.g. a variable) you remove it from the top or
the bottom of the memory range.

  [  a  ]

  [  b  ]

  [  c  ]

  [  d  ]

  [  e  ]

  [  f  ]

  [  g  ]

---

Using an array as a dequeue:

Other possibilities to store the information is an array.

To add new information (e.g. a variable) you put it in the top or
bottom of the array.

To remove information (e.g. a variable) you remove it from the top or
the bottom of the array.

  [  a  ]

  [  b  ]

  [  c  ]

  [  d  ]

  [  e  ]

  [  f  ]

  [  g  ]

---
---

Internet: see also:

---

Datastructure: Link: Overview: Can you give an overview of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/32054/fid/1264

---

Delphi: Search: Regular expression: Create: How to create a regular 
expression parser in Delphi?
http://www.faqts.com/knowledge_base/view.phtml/aid/25645/fid/175

----------------------------------------------------------------------