Skip to content

Commit 257d813

Browse files
Updated Readme
1 parent 6209e59 commit 257d813

File tree

1 file changed

+8
-182
lines changed

1 file changed

+8
-182
lines changed

README.md

+8-182
Original file line numberDiff line numberDiff line change
@@ -11,192 +11,18 @@ You can play around (run and edit) the Algorithms or contribute to them using Gi
1111

1212
### All algorithms implemented in Java (for education)
1313

14-
These are for demonstration purposes only. There are many implementations of sorts in the Java standard library that are much better for performance reasons.
14+
These implementations are for learning purposes. They may be less efficient than the implementations in the Java standard library.
1515

16-
## Sort Algorithms
16+
## Contribution Guidelines
1717

18+
Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute.
1819

19-
### Bubble
20-
![alt text][bubble-image]
20+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg?style=flat-square)](https://gitpod.io/#https://github.com/TheAlgorithms/java)
2121

22-
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.
22+
## Community Channel
2323

24-
__Properties__
25-
* Worst case performance O(n^2)
26-
* Best case performance O(n)
27-
* Average case performance O(n^2)
24+
We're on [Gitter](https://gitter.im/TheAlgorithms)! Please join us.
2825

29-
##### View the algorithm in [action][bubble-toptal]
26+
## Algorithms
3027

31-
32-
33-
### Insertion
34-
![alt text][insertion-image]
35-
36-
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.
37-
In the figure, each bar represents an element of an array that needs to be sorted. What happens at the first intersection of the top most and second top most bars is to swap these elements, represented by bars, because the second element has a higher precedence than the first element does. By repeating this method, insertion sort completes sorting.
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 spelt 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) (typical)
54-
* Best case performance O(n log n)
55-
* Average case performance O(n log 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 log n)
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.
88-
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
93-
94-
##### View the algorithm in [action][shell-toptal]
95-
96-
### Time-Complexity Graphs
97-
98-
Comparing the complexity of sorting algorithms (Bubble Sort, Insertion Sort, Selection Sort)
99-
100-
[Complexity Graphs](https://github.com/prateekiiest/Python/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-
The linear search runs in at the 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-
##### View the algorithm in [action][linear-tutorialspoint]
119-
120-
### Binary
121-
![alt text][binary-image]
122-
123-
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.
124-
125-
__Properties__
126-
* Worst case performance O(log n)
127-
* Best case performance O(1)
128-
* Average case performance O(log n)
129-
* Worst case space complexity O(1)
130-
131-
##### View the algorithm in [action][binary-tutorialspoint]
132-
133-
[bubble-toptal]: https://www.toptal.com/developers/sorting-algorithms/bubble-sort
134-
[bubble-wiki]: https://en.wikipedia.org/wiki/Bubble_sort
135-
[bubble-image]: https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Bubblesort-edited-color.svg/220px-Bubblesort-edited-color.svg.png "Bubble Sort"
136-
137-
[insertion-toptal]: https://www.toptal.com/developers/sorting-algorithms/insertion-sort
138-
[insertion-wiki]: https://en.wikipedia.org/wiki/Insertion_sort
139-
[insertion-image]: https://upload.wikimedia.org/wikipedia/commons/7/7e/Insertionsort-edited.png "Insertion Sort"
140-
141-
[quick-toptal]: https://www.toptal.com/developers/sorting-algorithms/quick-sort
142-
[quick-wiki]: https://en.wikipedia.org/wiki/Quicksort
143-
[quick-image]: https://upload.wikimedia.org/wikipedia/commons/6/6a/Sorting_quicksort_anim.gif "Quick Sort"
144-
145-
[merge-toptal]: https://www.toptal.com/developers/sorting-algorithms/merge-sort
146-
[merge-wiki]: https://en.wikipedia.org/wiki/Merge_sort
147-
[merge-image]: https://upload.wikimedia.org/wikipedia/commons/c/cc/Merge-sort-example-300px.gif "Merge Sort"
148-
149-
[selection-toptal]: https://www.toptal.com/developers/sorting-algorithms/selection-sort
150-
[selection-wiki]: https://en.wikipedia.org/wiki/Selection_sort
151-
[selection-image]: https://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Selection_sort_animation.gif/250px-Selection_sort_animation.gif "Selection Sort Sort"
152-
153-
[shell-toptal]: https://www.toptal.com/developers/sorting-algorithms/shell-sort
154-
[shell-wiki]: https://en.wikipedia.org/wiki/Shellsort
155-
[shell-image]: https://upload.wikimedia.org/wikipedia/commons/d/d8/Sorting_shellsort_anim.gif "Shell Sort"
156-
157-
[linear-wiki]: https://en.wikipedia.org/wiki/Linear_search
158-
[linear-image]: http://www.tutorialspoint.com/data_structures_algorithms/images/linear_search.gif
159-
[linear-tutorialspoint]: https://www.tutorialspoint.com/data_structures_algorithms/linear_search_algorithm.htm
160-
161-
[binary-wiki]: https://en.wikipedia.org/wiki/Binary_search_algorithm
162-
[binary-image]: https://upload.wikimedia.org/wikipedia/commons/f/f7/Binary_search_into_array.png
163-
[binary-tutorialspoint]: https://www.tutorialspoint.com/data_structures_algorithms/binary_search_algorithm.htm
164-
165-
166-
--------------------------------------------------------------------
167-
## Links to the rest of the algorithms
168-
169-
Conversions | Dynamic Programming |Ciphers|Miscellaneous|
170-
----------- |----------------------------------------------------------------|-------|-------------|
171-
[Any Base to Any Base](Conversions/AnyBaseToAnyBase.java)| [Coin Change](DynamicProgramming/CoinChange.java)|[Caesar](ciphers/Caesar.java)|[Heap Sort](Misc/heap_sort.java)|
172-
[Any Base to Decimal](Conversions/AnyBaseToDecimal.java)|[Egg Dropping](DynamicProgramming/EggDropping.java)|[Columnar Transposition Cipher](ciphers/ColumnarTranspositionCipher.java)|[Palindromic Prime Checker](Misc/PalindromePrime.java)|
173-
[Binary to Decimal](Conversions/BinaryToDecimal.java)|[Fibonacci](DynamicProgramming/Fibonacci.java)|[RSA](ciphers/RSA.java)|More soon...|
174-
[Binary to HexaDecimal](Conversions/BinaryToHexadecimal.java)|[Kadane Algorithm](DynamicProgramming/KadaneAlgorithm.java)|more coming soon...|
175-
[Binary to Octal](Conversions/BinaryToOctal.java)|[Knapsack](DynamicProgramming/Knapsack.java)|
176-
[Decimal To Any Base](Conversions/DecimalToAnyBase.java)|[Longest Common Subsequence](DynamicProgramming/LongestCommonSubsequence.java)|
177-
[Decimal To Binary](Conversions/DecimalToBinary.java)|[Longest Increasing Subsequence](DynamicProgramming/LongestIncreasingSubsequence.java)|
178-
[Decimal To Hexadecimal](Conversions/DecimalToHexaDecimal.java)|[Rod Cutting](DynamicProgramming/RodCutting.java)|
179-
and much more...| and more...|
180-
181-
### Data Structures
182-
Graphs|Heaps|Lists|Queues|
183-
------|-----|-----|------|
184-
[BFS](DataStructures/Graphs/BFS.java)|[Empty Heap Exception](DataStructures/Heaps/EmptyHeapException.java)|[Circle Linked List](DataStructures/Lists/CircleLinkedList.java)|[Generic Array List Queue](DataStructures/Queues/GenericArrayListQueue.java)|
185-
[DFS](DataStructures/Graphs/DFS.java)|[Heap](DataStructures/Heaps/Heap.java)|[Doubly Linked List](DataStructures/Lists/DoublyLinkedList.java)|[Queues](DataStructures/Queues/Queues.java)|
186-
[Graphs](DataStructures/Graphs/Graphs.java)|[Heap Element](DataStructures/Heaps/HeapElement.java)|[Singly Linked List](DataStructures/Lists/SinglyLinkedList.java)|
187-
[Kruskals Algorithm](DataStructures/Graphs/KruskalsAlgorithm.java)|[Max Heap](DataStructures/Heaps/MaxHeap.java)|
188-
[CursorLinkedList](DataStructures/Lists/CursorLinkedList.java)|
189-
[Matrix Graphs](DataStructures/Graphs/MatrixGraphs.java)|[Min Heap](DataStructures/Heaps/MinHeap.java)|
190-
[PrimMST](DataStructures/Graphs/PrimMST.java)|
191-
192-
Stacks|Trees|
193-
------|-----|
194-
[Node Stack](DataStructures/Stacks/NodeStack.java)|[AVL Tree](DataStructures/Trees/AVLTree.java)|
195-
[Stack of Linked List](DataStructures/Stacks/StackOfLinkedList.java)|[Binary Tree](DataStructures/Trees/BinaryTree.java)|
196-
[Array Stack](DataStructures/Stacks/StackArray.java)|And much more...|
197-
[ArrayList Stack](DataStructures/Stacks/StackArrayList.java)||
198-
199-
* [Bags](DataStructures/Bags/Bag.java)
200-
* [Buffer](DataStructures/Buffers/CircularBuffer.java)
201-
* [HashMap](DataStructures/HashMap/Hashing/HashMap.java)
202-
* [Matrix](DataStructures/Matrix/Matrix.java)
28+
See our [directory](DIRECTORY.md).

0 commit comments

Comments
 (0)