Data Structures

Elvenware Logo

TOC

JavaScript DataStructures

Here we will discuss various data structures that can be used in a JavaScript application.

Below I provide the names commonly used in Computer Science courses that cover data structures. We will need to create classes that use these names. It is more important that you use the conventional names than that you avoid a functional call in order to "optimize" your code.

Queues

The classic real world example of a queue is a line at a cash register.

The methods are as follows:

In addition, you will need an array to hold the data. Typically this called data.

Stacks

The classic real world example of a stack is a set of trays or plates at a lunch counter.

The methods are as follows:

In addition, you will need an array to hold the data. Typically this called data.

There is some question as to whether or not top serves any purpose in JavaScript.

Written with StackEdit.