April 14, 2017

List ADT: Data Structures & Algorithms in JavaScript P.1

I’m learning about data structures and algorithms in JavaScript. I’m using various online resources and going to be sharing my notes as a series of blog posts. The topics are below:
  • Data Structures: List ADT | Linked Lists | Trees, Tries & Graphs | Stacks & Queues Heaps | Hash Tables
  • Algorithms: Breadth-First Search | Depth-First Search | Binary Search | Merge Sort | Quick Sort
  • Concepts: Memory (Stack vs. Heap) | Recursion | Big O Time & Space
Why even learn Data Structures & Algorithms?
  • Quite simply because Algorithms + Data Structures = Programs (Niklau)
  • Any program is going to need some type of data structure to store and manage the data that it is manipulating and one or more algorithms for translating that data from its input form to its output form.
  • There is always more than one data structure or algorithm for a particular problem so studying the pros and cons of each type is a critical skill for a programmer.

So, first up…

1. List ADT (Abstract Data Type)

  • A list is an ordered sequence of data.
  • In JavaScript each data item stored is called an element and can be of any data type.
  • Below is the List class implementation


  • Methods of the List class


  • Creating a List class instance and traversing through it


Next up: Linked Lists!

Leave a Reply

Your email address will not be published. Required fields are marked *