Stacks and Queues

-Intro to Stack
-BIG O of Stacks
-Intro to Queues

Intro to Stacks

A stack is a last in first out data structure (LIFO) which means that the last element added to the stack will be …


This content originally appeared on DEV Community and was authored by Code_Regina

                   -Intro to Stack
                   -BIG O of Stacks
                   -Intro to Queues

Intro to Stacks

A stack is a last in first out data structure (LIFO) which means that the last element added to the stack will be the first element removed from the stack.

Stacks are used to manage function invocations.
As well as undo/redo actions.

BIG O of Stacks

Alt Text

Intro to Queues

A queue is a first in first out data structure (FIFO)
queues are used in background tasks, uploading resources, printing / task processing


class Queue {
  constructor() {
     this.first = null; 
     this.last = null; 
     this.size = 0; 
   }
 }

class Node {
  constructor(value) {
    this.value = value; 
    this.next = null; 
  }
 }



This content originally appeared on DEV Community and was authored by Code_Regina


Print Share Comment Cite Upload Translate Updates
APA

Code_Regina | Sciencx (2021-10-01T23:57:46+00:00) Stacks and Queues. Retrieved from https://www.scien.cx/2021/10/01/stacks-and-queues/

MLA
" » Stacks and Queues." Code_Regina | Sciencx - Friday October 1, 2021, https://www.scien.cx/2021/10/01/stacks-and-queues/
HARVARD
Code_Regina | Sciencx Friday October 1, 2021 » Stacks and Queues., viewed ,<https://www.scien.cx/2021/10/01/stacks-and-queues/>
VANCOUVER
Code_Regina | Sciencx - » Stacks and Queues. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/10/01/stacks-and-queues/
CHICAGO
" » Stacks and Queues." Code_Regina | Sciencx - Accessed . https://www.scien.cx/2021/10/01/stacks-and-queues/
IEEE
" » Stacks and Queues." Code_Regina | Sciencx [Online]. Available: https://www.scien.cx/2021/10/01/stacks-and-queues/. [Accessed: ]
rf:citation
» Stacks and Queues | Code_Regina | Sciencx | https://www.scien.cx/2021/10/01/stacks-and-queues/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.