78 Commits

Author SHA1 Message Date
a6ae951580 fix: removed warning for Sorts 'C-style array declaration of parameter 'array'' 2019-12-30 13:03:14 +07:00
3259944dbc Update BubbleSort.java
Output from print(integers) returns [78, 231, 54, 23, 12, 9, 6, 4, 1]
Correct output should be: [231, 78, 54, 23, 12, 9, 6, 4, 1]
2019-11-23 12:22:27 -05:00
8881e9aa4e make code more readable 2019-09-26 10:02:58 +08:00
0821df893a Update QuickSort.java 2019-07-06 20:56:05 +08:00
7cd8552502 Using randomize partition to avoid the basically ordered sequences 2019-07-06 20:54:55 +08:00
b1d4be7f86 docs: update AnyBaseToAnyBase and GenericTree 2019-05-09 20:20:44 +08:00
29948363da docs: update the whole repository
* fix some bugs
* delete duplicate files
* format code
2019-05-09 19:32:54 +08:00
21a7b9db58 Update MergeSort.java 2019-01-13 05:13:09 +08:00
819b7fd3da Restructured the repo 2018-11-13 09:15:47 -08:00
ba57c1d734 reimplement CocktailShakerSort 2018-05-29 19:31:56 +08:00
a471c0224b fix error comments 2018-05-29 17:44:14 +08:00
wzx
172998b1ba the second array may have residual elements. 2018-04-26 21:59:35 +08:00
nik
c0020903e2 Added a iterative version of ternary search algorithm and some minor changes in documentation 2018-04-13 09:36:44 +03:00
nik
cf778675df Comb sort was implemented 2018-04-12 10:14:22 +03:00
f808a2b217 Merge pull request #411 from nikitap492/refactoring
Generalizing & Refactoring
2018-04-11 17:36:12 +02:00
nik
e83317fd89 Added PancakeSort and the other minor changes 2018-04-10 12:48:21 +03:00
nik
e15cfb29b1 Added GnomeSort 2018-04-10 11:32:49 +03:00
nik
18a5148576 Refactored HeapSort 2018-04-10 11:16:28 +03:00
nik
9491b45a05 Minor changes 2018-04-09 21:14:40 +03:00
18808175da Merge pull request #409 from nikitap492/master
Thanks for contribution
2018-04-09 15:20:02 +02:00
nik
d4bd9e7c7d Replaced the left sorts to the new package 2018-04-09 15:50:48 +03:00
nik
52d1182de5 Refactored BubbleSort, CycleSort, CocktailShakerSort 2018-04-09 15:48:08 +03:00
nik
b01c2cf2c6 Refactored bogo sort and bubble sort 2018-04-09 15:24:16 +03:00
nik
65361a4445 Refactored and fixed the bugs in BinaryTreeSort 2018-04-09 15:12:40 +03:00
nik
874940160a Added the default method to sort a list to the sort interface
Changes in InsertionSort and CountingSort
2018-04-09 14:04:46 +03:00
nik
5560be8262 MergeSort was implemented SortAlgorithm 2018-04-09 13:41:39 +03:00
nik
2c356b563f The sorting structure was driven to a general java project structure
Fixed the bugs in QuickSort
Refactored QuickSort
2018-04-09 13:25:02 +03:00
nik
35f21f3b1b Refactored SelectionSort 2018-04-09 12:12:30 +03:00
nik
3c40937c66 Created general interface for most algorithms
Created utils methods
Refactored ShellSort
2018-04-09 12:05:41 +03:00
nik
205aec0c4f Changed the names of the counting sort methods
Added curly braces for the loop
2018-04-09 09:57:03 +03:00
1f76cda0e8 Merge pull request #287 from sandeeproy99/patch-3
CombSort.java
2018-04-08 19:53:08 +02:00
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
f8542e4db7 Updated CombSort.java
As requested done the changes.
2018-04-05 14:31:51 +05:30
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
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
6806fa6623 Create cyclesort.java 2017-10-28 11:47:45 +05:30
ee5136c64d Merge pull request #158 from karimElmougi/BogoSort
Bogo sort
2017-10-27 14:43:35 +05:30
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
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
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
b69548e85b Merge pull request #155 from achaJackson/master
Added and Implemented Counting sort with Java. #96.
2017-10-25 17:00:58 +05:30
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
952accaf48 Code changes by request 2017-10-23 21:01:02 -02:00
9d819349e2 Delete InsertionSortInteger.java
Solves #84
2017-10-23 15:33:28 -07:00
186c5d0253 Adding cocktail sort 2017-10-23 19:36:37 -02:00
22220d1049 Create CountingSort.java 2017-10-14 12:52:55 +02:00
3d34022fd9 Update CountingSortIntegers.java 2017-10-13 22:24:36 +02:00
295ff41346 Create CountingSortIntegers.java 2017-10-13 22:15:31 +02:00
8717d61b59 Add bogo sort 2017-10-05 10:37:31 -04:00
35bd2bb9df #96.Added and Implemented Counting sort with Java 2017-10-05 13:23:11 +01:00