1.0.0 • Public • Published

TypeScript Algorithms and Data Structures

This repository contains TypeScript based examples of many popular algorithms and data structures.

What is Data Structure ?

In computer terms, a data structure is a Specific way to store and organize data in a computer's memory so that these data can be used efficiently later. Data may be arranged in many different ways such as the logical or mathematical model for a particular organization of data is termed as a data structure. The variety of a specific data model depends on the two factors it must be loaded enough in structure to reflect the actual relationships of the data with the real world object , the formation should be simple enough so that anyone can efficiently process the data each time it is necessary.

As we have discussed above, anything that can store data can be called as a data structure, hence Integer, Float, Boolean, Char etc, all are data structures. They are known as Primitive Data Structures. Then we also have some complex Data Structures, which are used to store large and connected data. Some example of Abstract Data Structure are :Linked List , Tree , Graph , Stack, Queue etc. All these data structures allow us to perform different operations on data. We select these data structures based on which type of operation is required .

What is Algorithm ?

An algorithm is a detailed series of instructions for carrying out an operation or solving a problem. In a non-technical approach, we use algorithms in everyday tasks, such as a recipe to bake a cake or a do-it-yourself handbook. Technically, computers use algorithms to list the detailed instructions for carrying out an operation. For example, to compute an employee’s paycheck, the computer uses an algorithm. To accomplish this task, appropriate data must be entered into the system. In terms of efficiency, various algorithms are able to accomplish operations or problem solving easily and quickly. Every Algorithm must satisfy the following properties:Input , Output , Definiteness , Finiteness , Correctness

What is Big O ?

Big O notation is used to communicate how fast an algorithm is. This can be important when evaluating other people’s algorithms, and when evaluating your own! In this article, I’ll explain what Big O notation is and give you a list of the most common running times for algorithms using it.

Implementation in TypeScript

Typescript is a superset of Javascript, which is designed to develop large Javascript applications. Being a superset of Javascript, existing Javascript programs are also valid Typescript programs, meaning you don’t have to worry about converting the whole existing Javascript code into Typescript at once. Instead if you wish to migrate your existing Javascript code to Typescript, you can do that gradually. There are some major benefits of using Typescript, which includes, support for Classes and Modules, Type-checking, ES6 features support, Class library API definition, support for Javascript packaging, and a lot more. The idea behind implementing data structure in TypeScript  helping developers to learn and practice algorithms and do it in JavaScript.All code is 100% covered with tests. This is done not only to keep code working correctly but also to give you an illustration of how each algorithms or data structure works Currently there are following data structures a covered: Linked List , Queue , Stack , Hash Table , Heap , Tree


MIT license.




Package Sidebar


npm i ts-data-structure

Weekly Downloads






Unpacked Size

301 kB

Total Files


Last publish


  • yasserameur