This repository contains popular data structures and algorithms implemented in Javascript. Also included is a test file with every problem statement to verify whether it passes the testcases.
Each data-structure and algorithm will also contain a readme file to explain the necessary concepts as well as the approach to be followed for solving the problem. At the end, the space and time complexities will also be mentioned for the solution.
🎉 If you are a beginner Javascript developer I hope you will learn a lot from this repository. If you are an experiencied developer I hope you could find something useful.
All contributions to this repository is welcomed with ❤️
A data structure is a particular way of organizing data in a computer so that it can be used effectively. This is particularly important when we have to deal with large amounts of data. If we do not posses the knowledge of common data structures, our programs will consume a lot of space in the memory and will be very difficult to access.
For example, suppose we have to store a bank statement of a customer. By using arrays we can store it easily. This helps in reducing the use of number of variables as we don’t need to create a separate variable for every credit or debit. All records can be accessed by simply traversing the array.
Data Structures that we will discuss in this repository are:
- Array
- Matrix
- LinkedList
- Stack
- Queue
- Graph
- Binary Tree
- Binary Search Tree
- Hashing
- Heaps
- Segment Tree
- AVL Tree
- Binary Indexed Tree
- Red Black Tree
- Trie
- Suffix Array and Suffix Tree
- Splay Tree
- B Tree
- K Dimensional Tree
- Advanced Lists
- Other Advanced Data Structures
An algorithm is a set of finite and well-defined instructions, typically to solve a class of problems or to perform a computation. Algorithms are a very important topic in Computer Science because they help software developers create efficient and error free programs. The most important thing to remember about algorithms is that there can be many different algorithms for the same problem, but some are much better than others.
Computers are incredibly fast at manipulating, moving and looking through data. However the amount of data computers use is often so large that it doesn't matter how fast the computer is, it will take it far too long to examine every single piece of data (companies like Google, Facebook and Twitter routinely process billions of things per day, and in some cases, per minute!). This is where algorithms come in. If a computer is given a better algorithm to process the data then it doesn't matter how much information it has to look through, it will still be able to do it in a reasonable amount of time. More Reading...