https://github.com/jaredblumer/js-algorithms
Implementations of Sorting and Search Algorithms in Javascript
https://github.com/jaredblumer/js-algorithms
Last synced: about 1 month ago
JSON representation
Implementations of Sorting and Search Algorithms in Javascript
- Host: GitHub
- URL: https://github.com/jaredblumer/js-algorithms
- Owner: jaredblumer
- Created: 2018-08-24T23:57:40.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-07-30T20:58:34.000Z (almost 2 years ago)
- Last Synced: 2025-01-28T13:47:19.858Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sorting and Search Algorithms in JavaScript
Welcome to the Sorting and Search Algorithms repository! This repository provides examples of various sorting and search algorithms implemented in JavaScript.
## Table of Contents
- [Sorting Algorithms](#sorting-algorithms)
- [Bubble Sort](#bubble-sort)
- [Selection Sort](#selection-sort)
- [Insertion Sort](#insertion-sort)
- [Merge Sort](#merge-sort)
- [Search Algorithms](#search-algorithms)
- [Linear Search](#linear-search)
- [Binary Search](#binary-search)
- [Author](#author)
- [License](#license)
## Sorting Algorithms
### [Bubble Sort](https://github.com/shyblumer/js-algorithms/blob/master/bubbleSort.js)
Bubble Sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.
- **Time Complexity:** O(n^2)
- **Space Complexity:** O(1)
### [Selection Sort](https://github.com/shyblumer/js-algorithms/blob/master/selectionSort.js)
Selection Sort divides the input list into two parts: the sublist of items already sorted, which is built up from left to right at the front (left) of the list, and the sublist of items remaining to be sorted that occupy the rest of the list.
- **Time Complexity:** O(n^2)
- **Space Complexity:** O(1)
### [Insertion Sort](https://github.com/shyblumer/js-algorithms/blob/master/insertionSort.js)
Insertion Sort builds the final sorted array one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.
- **Time Complexity:** O(n^2)
- **Space Complexity:** O(1)
### [Merge Sort](https://github.com/shyblumer/js-algorithms/blob/master/mergeSort.js)
Merge Sort is an efficient, stable, comparison-based, divide and conquer sorting algorithm. Most implementations produce a stable sort, meaning that the implementation preserves the input order of equal elements in the sorted output.
- **Time Complexity:** O(n log n)
- **Space Complexity:** O(n)
## Search Algorithms
### [Linear Search](https://github.com/shyblumer/js-algorithms/blob/master/linearSearch.js)
Linear Search is a method for finding an element within a list. It sequentially checks each element of the list until a match is found or the whole list has been searched.
- **Time Complexity:** O(n)
- **Space Complexity:** O(1)
### [Binary Search](https://github.com/shyblumer/js-algorithms/blob/master/binarySearch.js)
Binary Search is a fast search algorithm with a time complexity of O(log n). This search algorithm works on the principle of divide and conquer. For this algorithm to work, the data collection should be in a sorted form.
- **Time Complexity:** O(log n)
- **Space Complexity:** O(1)
## Author
**Jared Blumer**, Full-Stack Software Engineer and Data Analyst
- [GitHub](https://github.com/jaredblumer)
- [LinkedIn](https://www.linkedin.com/in/jaredblumer/)
## License
This project is licensed under the [MIT License](https://opensource.org/license/mit).