Website Summary Files Commits Branches @commit @diff @stats
path: root / homework / 45183 / CodeFormatting / input2.js
diff options
context:
space:
mode:
Commitaeb0d4f887a0c18c36b59acc7b5df08e62020c50 (patch)
Author
 Dimitar Trendafilov <dimitar@coherent-labs.com>
2020-10-11 21:32:48 +0300
Committer
 Dimitar Trendafilov <dimitar@coherent-labs.com>
2020-10-11 21:33:38 +0300
Filesb6abdc6e1810326b587f2a160f39570f1f568f27 /homework/45183/CodeFormatting/input2.js
IPL-aeb0d4f887a0c18c36b59acc7b5df08e62020c50.tar
IPL-aeb0d4f887a0c18c36b59acc7b5df08e62020c50.tar.gz
IPL-aeb0d4f887a0c18c36b59acc7b5df08e62020c50.zip
Parent154b7cd30f21af1554ca26986ff1643e28857727 (diff)
Removed old homeworks
1 files changed, 0 insertions, 71 deletions
-rw-r--r--homework/45183/CodeFormatting/input2.js71
diff --git a/homework/45183/CodeFormatting/input2.js b/homework/45183/CodeFormatting/input2.js
deleted file mode 100644
index c1c377c..0000000
--- a/homework/45183/CodeFormatting/input2.js
+++ /dev/null
@@ -1,71 +0,0 @@
-export default class Queue {
- constructor() {
- this._firstNode = null;
- this._lastNode = null;
- }
-
- /**
- * Retrieves the first element in the queue.
- * It also removes it from the queue.
- * @returns {*}
- */
- dequeue() {
- if (!this._firstNode) {
- return this._firstNode;
- }
-
- const payload = this._firstNode.payload;
-
- this._firstNode = this._firstNode.next;
-
- return payload;
- }
-
- /**
- * Adds an item to the queue
- * @param {*} item
- */
- enqueue(item) {
- const newNode = {
- payload: item,
- next: null
- };
-
- if (this._firstNode === null) {
- this._firstNode = newNode;
- this._lastNode = newNode;
-
- } else {
- this._lastNode.next = newNode;
- this._lastNode = newNode;
- }
- }
-
- /**
- * Empties the queue
- */
- clear() {
- this._firstNode = null;
- this._lastNode = null;
- }
-
- /**
- * Gets the first element of the queue
- * @returns {*}
- */
- top() {
- if (!this._firstNode) {
- return this._firstNode;
- }
-
- return this._firstNode.payload;
- }
-
- /**
- * Checks whether the queue is empty or not
- * @returns {boolean}
- */
- isEmpty() {
- return !this._firstNode;
- }
-} \ No newline at end of file