Commit Graph

97 Commits

Author SHA1 Message Date
nik
f564fa4ea1 Added the counting sort method which uses stream API
Changed the original sorting method: creating and throwing an exception it costs then using getOrDefault for a map
2018-04-06 11:34:52 +03:00
Sandeep Roy
f8542e4db7
Updated CombSort.java
As requested done the changes.
2018-04-05 14:31:51 +05:30
khongta0932488598
01d699924e
QuickSortAlgo.java
Change to List<E> for any type of array.
Change value of pivot to value of middle index of unsorted array.
2018-03-29 21:47:45 +11:00
sandeeproy99
07015c1e64
CombSort.java
Comb Sort is mainly an improvement over Bubble Sort. Bubble sort always compares adjacent values. So all inversions are removed one by one. Comb Sort improves on Bubble Sort by using gap of size more than 1. The gap starts with a large value and shrinks by a factor of 1.3 in every iteration until it reaches the value 1. Thus Comb Sort removes more than one inversion counts with one swap and performs better than Bubble Sort.

The shrink factor has been empirically found to be 1.3 (by testing CombSort on over 200,000 random lists) [Source: Wiki]

Although, it works better than Bubble Sort on average, worst case remains O(n2).
2017-10-28 16:03:26 +05:30
Honey Sharma
6806fa6623
Create cyclesort.java 2017-10-28 11:47:45 +05:30
Chetan Kaushik
ee5136c64d Merge pull request #158 from karimElmougi/BogoSort
Bogo sort
2017-10-27 14:43:35 +05:30
Kenneth Nero
2a1fc02648 Many quality of code changes
Removing unused imports, cleaning up (at a base level) code, and removing some package declarations. By no means did I get all of them.
2017-10-26 19:56:18 -04:00
Varun Upadhyay
b0155e36a2 Delete CountingSortIntegers.java
Removing as a generic version of counting sort already exists in Sorts
[Counting Sort](https://github.com/TheAlgorithms/Java/blob/master/Sorts/CountingSort.java)
2017-10-25 06:33:01 -07:00
Varun Upadhyay
497f27f630 Delete CountSort.java
Removing as a generic version of counting sort already exists in Sorts
[Counting Sort](https://github.com/TheAlgorithms/Java/blob/master/Sorts/CountingSort.java)
2017-10-25 06:32:46 -07:00
Chetan Kaushik
b69548e85b Merge pull request #155 from achaJackson/master
Added and Implemented Counting sort with Java. #96.
2017-10-25 17:00:58 +05:30
Varun Upadhyay
810fdd6102 Merge pull request #258 from MattBizzo/master
Adding cocktail shaker sort
@MattBizzo  Thanks for the PR
2017-10-23 16:06:26 -07:00
MattBizzo
952accaf48 Code changes by request 2017-10-23 21:01:02 -02:00
Varun Upadhyay
9d819349e2 Delete InsertionSortInteger.java
Solves #84
2017-10-23 15:33:28 -07:00
MattBizzo
186c5d0253 Adding cocktail sort 2017-10-23 19:36:37 -02:00
Youssef Ali
22220d1049 Create CountingSort.java 2017-10-14 12:52:55 +02:00
Youssef Ali
3d34022fd9 Update CountingSortIntegers.java 2017-10-13 22:24:36 +02:00
Youssef Ali
295ff41346 Create CountingSortIntegers.java 2017-10-13 22:15:31 +02:00
karimElmougi
8717d61b59 Add bogo sort 2017-10-05 10:37:31 -04:00
Acha Jackson
35bd2bb9df #96.Added and Implemented Counting sort with Java 2017-10-05 13:23:11 +01:00
Dusan Punosevac
f7f70b575b Added Shell Sort 2017-09-28 18:33:36 +02:00
Chetan Kaushik
5f1fb61f07 Merge pull request #86 from JosephMPignataro/master
Adding a Node class and Binary Tree Sorting algorithm
2017-09-13 20:24:17 +05:30
Varun Upadhyay
bd42abccd9 Updated SelectionSort.java
Updated SelectionSort.java to its generic version
2017-09-07 19:11:35 -07:00
Varun Upadhyay
146a08cabf Updated MergeSort.java
Updated MergeSort into its generic form
2017-08-25 11:43:44 -07:00
Varun Upadhyay
e9b1e2542b Updated QuickSort.java
Updated quicksort to its generic version and changed the filename according to convention
2017-08-21 11:20:04 -07:00
Joseph M Pignataro
707bf5c5a9 Remake of TreeSort
Uses Node class in misc files. Remade after a typo in the last file.
2017-08-21 13:54:34 -04:00
Joseph M Pignataro
7929651c3a Delete BinaryTreeSearch.java
Wrong title
2017-08-21 13:53:15 -04:00
Joseph M Pignataro
f16117e109 Tree search
Uses Node class in misc.
2017-08-21 13:51:57 -04:00
Varun Upadhyay
96af9a7d63 Update BubbleSort.java
Changed the method description
2017-08-20 07:51:16 -07:00
Varun Upadhyay
2eb75e15f1 Update InsertionSort.java 2017-08-20 07:50:29 -07:00
Varun Upadhyay
2b02d48377 Updated Insertion Sort
Updated Insertion Sort to its Generic version
2017-08-20 07:48:19 -07:00
Varun Upadhyay
9f0d7b6518 Updated BubbleSort.java
Updated BubbleSort.java to its generic version
2017-08-19 07:41:14 -07:00
UsernameToLon
e5dd6eff02 Updated to more efficient version if array size is scaled.
Changed loop from "for" to "do-while". Added decrement at end of do loop to decrease size of array tested after each iteration.
2017-05-18 14:11:47 -04:00
Chetan Kaushik
ee3280563d Merge pull request #39 from theycallmemac/patch-11
Rename HeapSort.java to Sorts/HeapSort.java
2017-04-27 20:05:06 +05:30
Chetan Kaushik
4e60f9ba6b Merge pull request #38 from theycallmemac/patch-10
Rename BubbleSort.java to Sorts/BubbleSort.java
2017-04-27 20:04:42 +05:30
Chetan Kaushik
1d1632509f Merge pull request #40 from theycallmemac/patch-12
Rename InsertionSort.java to Sorts/InsertionSort.java
2017-04-27 20:04:38 +05:30
Chetan Kaushik
8c60fea02e Merge pull request #41 from theycallmemac/patch-13
Rename InsertionSortInteger.java to Sorts/InsertionSortInteger.java
2017-04-27 20:04:17 +05:30
Chetan Kaushik
398cc6ce8c Merge pull request #42 from theycallmemac/patch-14
Rename MergeSort.java to Sorts/MergeSort.java
2017-04-27 20:04:01 +05:30
Chetan Kaushik
f0c38df2e9 Merge pull request #43 from theycallmemac/patch-15
Rename Quicksort.java to Sorts/Quicksort.java
2017-04-27 20:03:50 +05:30
Chetan Kaushik
84eb97306c Merge pull request #44 from theycallmemac/patch-16
Rename SelectionSort.java to Sorts/SelectionSort.java
2017-04-27 20:03:14 +05:30
James Mc Dermott
3ead086ef3 Rename radixSort.java to Sorts/radixSort.java 2017-04-27 15:30:05 +01:00
James Mc Dermott
88338805a3 Rename SelectionSort.java to Sorts/SelectionSort.java 2017-04-27 15:29:41 +01:00
James Mc Dermott
7d586be1de Rename Quicksort.java to Sorts/Quicksort.java 2017-04-27 15:29:16 +01:00
James Mc Dermott
e99bf76fe7 Rename MergeSort.java to Sorts/MergeSort.java 2017-04-27 15:28:55 +01:00
James Mc Dermott
ff6dceb9d6 Rename InsertionSortInteger.java to Sorts/InsertionSortInteger.java 2017-04-27 15:28:20 +01:00
James Mc Dermott
440ba12ec0 Rename InsertionSort.java to Sorts/InsertionSort.java 2017-04-27 15:27:23 +01:00
James Mc Dermott
899eae0423 Rename HeapSort.java to Sorts/HeapSort.java 2017-04-27 15:26:05 +01:00
James Mc Dermott
04f120c830 Rename BubbleSort.java to Sorts/BubbleSort.java 2017-04-27 15:25:43 +01:00