ArrQueue

ArrQueue

선입선출(First-In-First-Out)의 자료구조이다.

Constructor

new ArrQueue()

Author:
  • yicho93@gmail.com
Example
var aq = new ArrQueue ();

Methods

(static) back()

This method is used to get the last value in this queue, but does not remove.
Example
var aq = new ArrQueue ();
aq.push(1); 
aq.push(2);
aq.push(3);
var ret = aq.back() // ret1 = 3
Returns:
This method returns the last value of this queue, or null if this queue is empty.

(static) clear()

This method is used to nullify this queue and make all variables initial.
Example
var aq = new ArrQueue ();
aq.push(1); 
aq.push(2);
aq.push(3);
aq.clear();

(static) front()

This method is used to get the first value in this queue, but does not remove.
Example
var aq = new ArrQueue ();
aq.push(1); 
aq.push(2);
aq.push(3);
var ret = aq.front() // ret1 = 1 
Returns:
This method returns the first value of this queue, or null if this queue is empty.

(static) isEmpty()

This method is used to check if this queue is empty.
Example
var aq = new ArrQueue ();
var ret1 = aq.isEmpty(); // ret1 = true
aq.push(1);
var ret2 = aq.isEmpty(); // ret2 = false
Returns:
This method returns ‘true’ if this queue is empty or ‘false’ if this queue is not empty.

(static) pop()

This method is used to remove value from this queue.
Example
var aq = new ArrQueue ();
aq.push(1); 
aq.push(2);
aq.pop() // 1 will be removed.
Returns:
This method returns the value which is poped.

(static) push(value)

This method is used to insert the specified value into this queue.
Example
var aq = new ArrQueue ();
aq.push(1);
aq.push(2);
Parameters:
Name Type Description
value undefined The value to be inserted to this queue.

(static) size()

This method is used to get the number of values in this queue.
Example
var aq = new ArrQueue ();
aq.push(1); 
aq.push(2);
aq.push(3);
var size = aq.size(); // size = 3
Returns:
This method returns the number of values in this queue.

(static) toString()

This method shows state of this queue.
Example
var aq = new ArrQueue ();
aq.push(1); 
aq.push(2);
aq.push(3);
aq.toString(); // 1, 2, 3