Skip to content

Commit 14bab1b

Browse files
authored
Update README.md
1 parent f74a3ae commit 14bab1b

File tree

1 file changed

+6
-191
lines changed

1 file changed

+6
-191
lines changed

README.md

Lines changed: 6 additions & 191 deletions
Original file line numberDiff line numberDiff line change
@@ -8,199 +8,14 @@
88

99
These are for demonstration purposes only. There are many implementations of sorts in the Javascript standard library that are much better for performance reasons.
1010

11-
## List of Algorithms
12-
13-
See our [directory](DIRECTORY.md).
14-
15-
16-
17-
## Sort Algorithms
18-
19-
20-
### Bubble
21-
![alt text][bubble-image]
22-
23-
From [Wikipedia][bubble-wiki]: Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.
24-
25-
__Properties__
26-
* Worst case performance O(n^2)
27-
* Best case performance O(n)
28-
* Average case performance O(n^2)
29-
30-
###### View the algorithm in [action][bubble-toptal]
31-
32-
33-
34-
### Insertion
35-
![alt text][insertion-image]
36-
37-
From [Wikipedia][insertion-wiki]: Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.
38-
39-
__Properties__
40-
* Worst case performance O(n^2)
41-
* Best case performance O(n)
42-
* Average case performance O(n^2)
43-
44-
###### View the algorithm in [action][insertion-toptal]
45-
46-
47-
### Merge
48-
![alt text][merge-image]
49-
50-
From [Wikipedia][merge-wiki]: In computer science, merge sort (also commonly spelled mergesort) is an efficient, general-purpose, comparison-based sorting algorithm. Most implementations produce a stable sort, which means that the implementation preserves the input order of equal elements in the sorted output. Mergesort is a divide and conquer algorithm that was invented by John von Neumann in 1945.
51-
52-
__Properties__
53-
* Worst case performance O(n log n)
54-
* Best case performance O(n)
55-
* Average case performance O(n)
56-
57-
58-
###### View the algorithm in [action][merge-toptal]
59-
60-
### Quick
61-
![alt text][quick-image]
62-
63-
From [Wikipedia][quick-wiki]: Quicksort (sometimes called partition-exchange sort) is an efficient sorting algorithm, serving as a systematic method for placing the elements of an array in order.
64-
65-
__Properties__
66-
* Worst case performance O(n^2)
67-
* Best case performance O(n log n) or O(n) with three-way partition
68-
* Average case performance O(n^2)
69-
70-
###### View the algorithm in [action][quick-toptal]
71-
72-
### Selection
73-
![alt text][selection-image]
74-
75-
From [Wikipedia][selection-wiki]: The algorithm 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. Initially, the sorted sublist is empty and the unsorted sublist is the entire input list. The algorithm proceeds by finding the smallest (or largest, depending on sorting order) element in the unsorted sublist, exchanging (swapping) it with the leftmost unsorted element (putting it in sorted order), and moving the sublist boundaries one element to the right.
76-
77-
__Properties__
78-
* Worst case performance O(n^2)
79-
* Best case performance O(n^2)
80-
* Average case performance O(n^2)
81-
82-
###### View the algorithm in [action][selection-toptal]
83-
84-
### Shell
85-
![alt text][shell-image]
86-
87-
From [Wikipedia][shell-wiki]: Shellsort is a generalization of insertion sort that allows the exchange of items that are far apart. The idea is to arrange the list of elements so that, starting anywhere, considering every nth element gives a sorted list. Such a list is said to be h-sorted. Equivalently, it can be thought of as h interleaved lists, each individually sorted.
11+
## Contribution Guidelines
8812

89-
__Properties__
90-
* Worst case performance O(nlog2 2n)
91-
* Best case performance O(n log n)
92-
* Average case performance depends on gap sequence
13+
Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute.
9314

94-
###### View the algorithm in [action][shell-toptal]
95-
96-
### Time-Compexity Graphs
97-
98-
Comparing the complexity of sorting algorithms (Bubble Sort, Insertion Sort, Selection Sort)
99-
100-
[Complexity Graphs](https://github.com/prateekiiest/Javascript/blob/master/sorts/sortinggraphs.png)
101-
102-
----------------------------------------------------------------------------------
103-
104-
## Search Algorithms
105-
106-
### Linear
107-
![alt text][linear-image]
108-
109-
From [Wikipedia][linear-wiki]: linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched.
110-
Linear search runs in at worst linear time and makes at most n comparisons, where n is the length of the list.
111-
112-
__Properties__
113-
* Worst case performance O(n)
114-
* Best case performance O(1)
115-
* Average case performance O(n)
116-
* Worst case space complexity O(1) iterative
117-
118-
### Binary
119-
![alt text][binary-image]
120-
121-
From [Wikipedia][binary-wiki]: Binary search, also known as half-interval search or logarithmic search, is a search algorithm that finds the position of a target value within a sorted array. It compares the target value to the middle element of the array; if they are unequal, the half in which the target cannot lie is eliminated and the search continues on the remaining half until it is successful.
122-
123-
__Properties__
124-
* Worst case performance O(log n)
125-
* Best case performance O(1)
126-
* Average case performance O(log n)
127-
* Worst case space complexity O(1)
128-
129-
### Jump
130-
![alt-text][jump-image]
131-
132-
From [Wikipedia][jump-wiki]: Jump search or block search refers to a search algorithm for ordered lists. It works by first checking all items Lkm, where {\displaystyle k\in \mathbb {N} } k\in \mathbb {N} and m is the block size, until an item is found that is larger than the search key. To find the exact position of the search key in the list a linear search is performed on the sublist L[(k-1)m, km].
133-
134-
__Properties__
135-
* Worst case performance  O(n)
136-
* Best case performance O(√n)
137-
* Average case performance  O(√n)
138-
* Worst case space complexity O(1)
139-
140-
141-
----------------------------------------------------------------------------------------------------------------------
142-
143-
## Ciphers
144-
145-
### Caesar
146-
![alt text][caesar]<br>
147-
In cryptography, a **Caesar cipher**, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques.<br>
148-
It is **a type of substitution cipher** in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. <br>
149-
The method is named after **Julius Caesar**, who used it in his private correspondence.<br>
150-
The encryption step performed by a Caesar cipher is often incorporated as part of more complex schemes, such as the Vigenère cipher, and still has modern application in the ROT13 system. As with all single-alphabet substitution ciphers, the Caesar cipher is easily broken and in modern practice offers essentially no communication security.
151-
###### Source: [Wikipedia](https://en.wikipedia.org/wiki/Caesar_cipher)
152-
153-
### Vigenère
154-
The **Vigenère cipher** is a method of encrypting alphabetic text by using a series of **interwoven Caesar ciphers** based on the letters of a keyword. It is **a form of polyalphabetic substitution**.<br>
155-
The Vigenère cipher has been reinvented many times. The method was originally described by Giovan Battista Bellaso in his 1553 book La cifra del. Sig. Giovan Battista Bellaso; however, the scheme was later misattributed to Blaise de Vigenère in the 19th century, and is now widely known as the "Vigenère cipher".<br>
156-
Though the cipher is easy to understand and implement, for three centuries it resisted all attempts to break it; this earned it the description **le chiffre indéchiffrable**(French for 'the indecipherable cipher').
157-
Many people have tried to implement encryption schemes that are essentially Vigenère ciphers. Friedrich Kasiski was the first to publish a general method of deciphering a Vigenère cipher in 1863.
158-
###### Source: [Wikipedia](https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher)
159-
160-
### Transposition
161-
In cryptography, a **transposition cipher** is a method of encryption by which the positions held by units of plaintext (which are commonly characters or groups of characters) are shifted according to a regular system, so that the ciphertext constitutes a permutation of the plaintext. That is, the order of the units is changed (the plaintext is reordered).<br>
162-
Mathematically a bijective function is used on the characters' positions to encrypt and an inverse function to decrypt.
163-
###### Source: [Wikipedia](https://en.wikipedia.org/wiki/Transposition_cipher)
164-
165-
----------------------------------------------------------------------------------------------------------------------
166-
167-
## Checksums
168-
169-
### Luhn's
170-
The Luhn algorithm or Luhn formula, also known as the "modulus 10" or "mod 10" algorithm, is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers, National Provider Identifier numbers in the United States, Canadian Social Insurance Numbers, Israel ID Numbers and Greek Social Security Numbers. It was created by IBM scientist Hans Peter Luhn and described in U.S. Patent No. 2,950,048, filed on January 6, 1954, and granted on August 23, 1960.
171-
###### Source: [Wikipedia](https://en.wikipedia.org/wiki/Transposition_cipher)
172-
[bubble-toptal]: https://www.toptal.com/developers/sorting-algorithms/bubble-sort
173-
[bubble-wiki]: https://en.wikipedia.org/wiki/Bubble_sort
174-
[bubble-image]: https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Bubblesort-edited-color.svg/220px-Bubblesort-edited-color.svg.png "Bubble Sort"
175-
176-
[insertion-toptal]: https://www.toptal.com/developers/sorting-algorithms/insertion-sort
177-
[insertion-wiki]: https://en.wikipedia.org/wiki/Insertion_sort
178-
[insertion-image]: https://upload.wikimedia.org/wikipedia/commons/7/7e/Insertionsort-edited.png "Insertion Sort"
179-
180-
[quick-toptal]: https://www.toptal.com/developers/sorting-algorithms/quick-sort
181-
[quick-wiki]: https://en.wikipedia.org/wiki/Quicksort
182-
[quick-image]: https://upload.wikimedia.org/wikipedia/commons/6/6a/Sorting_quicksort_anim.gif "Quick Sort"
183-
184-
[merge-toptal]: https://www.toptal.com/developers/sorting-algorithms/merge-sort
185-
[merge-wiki]: https://en.wikipedia.org/wiki/Merge_sort
186-
[merge-image]: https://upload.wikimedia.org/wikipedia/commons/c/cc/Merge-sort-example-300px.gif "Merge Sort"
187-
188-
[selection-toptal]: https://www.toptal.com/developers/sorting-algorithms/selection-sort
189-
[selection-wiki]: https://en.wikipedia.org/wiki/Selection_sort
190-
[selection-image]: https://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Selection_sort_animation.gif/250px-Selection_sort_animation.gif "Selection Sort Sort"
191-
192-
[shell-toptal]: https://www.toptal.com/developers/sorting-algorithms/shell-sort
193-
[shell-wiki]: https://en.wikipedia.org/wiki/Shellsort
194-
[shell-image]: https://upload.wikimedia.org/wikipedia/commons/d/d8/Sorting_shellsort_anim.gif "Shell Sort"
195-
196-
[linear-wiki]: https://en.wikipedia.org/wiki/Linear_search
197-
[linear-image]: http://www.tutorialspoint.com/data_structures_algorithms/images/linear_search.gif
198-
199-
[binary-wiki]: https://en.wikipedia.org/wiki/Binary_search_algorithm
200-
[binary-image]: https://upload.wikimedia.org/wikipedia/commons/f/f7/Binary_search_into_array.png
15+
## List of Algorithms
20116

202-
[jump-wiki]: https://en.wikipedia.org/wiki/Jump_search
203-
[jump-image]: https://i1.wp.com/theoryofprogramming.com/wp-content/uploads/2016/11/jump-search-1.jpg
17+
See our [directory](DIRECTORY.md).
20418

19+
## Algorithm Explanation
20520

206-
[caesar]: https://upload.wikimedia.org/wikipedia/commons/4/4a/Caesar_cipher_left_shift_of_3.svg
21+
see our [wiki](https://github.com/TheAlgorithms/Javascript/wiki)

0 commit comments

Comments
 (0)