-
Notifications
You must be signed in to change notification settings - Fork 0
/
demos.double.js
103 lines (79 loc) · 2.33 KB
/
demos.double.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/**
*
* Package: queues.js
* Author: Ganesh B
* Description:
* Install: npm i queues.js --save
* Github: https://github.com/ganeshkbhat/queues.js
* npmjs Link: https://www.npmjs.com/package/queues.js
* File: .js
* File Description: .js
*
*/
/* eslint no-console: 0 */
'use strict';
var Queue = require("../index.js").DoubleEnded;
var queue = new Queue();
queue.insertFront(1);
queue.insertFront(2);
queue.insertFront(3);
queue.insertFront(4);
queue.insertFront(5);
queue.insertFront(6);
queue.insertFront(7);
queue.insertFront(8);
console.log("queue.size()", queue.size());
console.log("queue.toArray()", queue.toArray());
console.log(queue.deleteLast());
console.log(queue.deleteLast());
console.log(queue.deleteLast());
console.log("queue.size()", queue.size());
console.log("queue.toArray()", queue.toArray());
queue = new Queue();
queue.insertFront(1);
queue.insertFront(2);
queue.insertFront(3);
queue.insertFront(4);
queue.insertFront(5);
queue.insertFront(6);
queue.insertFront(7);
queue.insertFront(8);
console.log("queue.size()", queue.size());
console.log("queue.toArray()", queue.toArray());
console.log(queue.deleteFront());
console.log(queue.deleteFront());
console.log(queue.deleteFront());
console.log("queue.size()", queue.size());
console.log("queue.toArray()", queue.toArray());
queue = new Queue();
queue.insertLast(1);
queue.insertLast(2);
queue.insertLast(3);
queue.insertLast(4);
queue.insertLast(5);
queue.insertLast(6);
queue.insertLast(7);
queue.insertLast(8);
console.log("queue.size()", queue.size());
console.log("queue.toArray()", queue.toArray());
console.log(queue.deleteLast());
console.log(queue.deleteLast());
console.log(queue.deleteLast());
console.log("queue.size()", queue.size());
console.log("queue.toArray()", queue.toArray());
queue = new Queue();
queue.insertLast(1);
queue.insertLast(2);
queue.insertLast(3);
queue.insertLast(4);
queue.insertLast(5);
queue.insertLast(6);
queue.insertLast(7);
queue.insertLast(8);
console.log("queue.size()", queue.size());
console.log("queue.toArray()", queue.toArray());
console.log(queue.deleteFront());
console.log(queue.deleteFront());
console.log(queue.deleteFront());
console.log("queue.size()", queue.size());
console.log("queue.toArray()", queue.toArray());