Skip to content

Tim sort Algorithm | #2003 #2110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Apr 23, 2021
Merged
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ff3e8f0
Add Tim Sort implementation in Java
hemanth-kotagiri Feb 17, 2021
8e60fb1
Merge branch 'master' of https://github.com/TheAlgorithms/Java into t…
hemanth-kotagiri Feb 21, 2021
120aee8
Add comments and complete implementation of TimSort Algorithm
hemanth-kotagiri Feb 21, 2021
e974ddf
Add better docs
hemanth-kotagiri Feb 27, 2021
edcd7e9
Merge branch 'master' of https://github.com/TheAlgorithms/Java into t…
hemanth-kotagiri Feb 27, 2021
e9458db
Add @brief's and test method
hemanth-kotagiri Mar 9, 2021
75b4a8e
Fix errors
hemanth-kotagiri Mar 9, 2021
0a86837
add Test method
hemanth-kotagiri Mar 10, 2021
327aea0
Update Sorts/TimSort.java
hemanth-kotagiri Mar 10, 2021
e673418
Update Sorts/TimSort.java
hemanth-kotagiri Mar 10, 2021
f09cd0d
Update Sorts/TimSort.java
hemanth-kotagiri Mar 10, 2021
40dc8f8
Update Sorts/TimSort.java
hemanth-kotagiri Mar 10, 2021
324cb4e
Update Sorts/TimSort.java
hemanth-kotagiri Mar 10, 2021
e29cb48
Update Sorts/TimSort.java
hemanth-kotagiri Mar 10, 2021
dd8ad4b
Update Sorts/TimSort.java
hemanth-kotagiri Mar 10, 2021
d1660bf
Update Sorts/TimSort.java
hemanth-kotagiri Mar 10, 2021
51e5627
Add tests
hemanth-kotagiri Apr 21, 2021
0223914
Merge branch 'tim_sort' of https://github.com/hemanth-kotagiri/Java i…
hemanth-kotagiri Apr 21, 2021
ed665f1
Update Sorts/TimSort.java
hemanth-kotagiri Apr 22, 2021
179c84a
Update Sorts/TimSort.java
ayaankhan98 Apr 23, 2021
0e81e1d
Update Sorts/TimSort.java
hemanth-kotagiri Apr 23, 2021
d76e46d
Update Sorts/TimSort.java
hemanth-kotagiri Apr 23, 2021
4d7862f
Update Sorts/TimSort.java
hemanth-kotagiri Apr 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions Sorts/TimSort.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* @see [Tim Sort](https://en.wikipedia.org/wiki/Tim_sort)
*/

//
class TimSort {
int array[];
int array_length;
Expand Down Expand Up @@ -71,10 +70,10 @@ public TimSort() {
/**
* @brief Performs Insertion Sort Algorithm on given array with bounded
* indices.
* @param array : The array on which the algorithm is to be performed.
* @param start_idx : The starting index from which the algorithm is to be
* @param array: The array on which the algorithm is to be performed.
* @param start_idx: The starting index from which the algorithm is to be
* performed.
* @param end_idx : The ending index at which the algorithm needs to stop
* @param end_idx: The ending index at which the algorithm needs to stop
* sorting.
*/

Expand All @@ -92,10 +91,10 @@ public void insertion_sort(int[] array, int start_idx, int end_idx) {

/**
* @brief A method to merge two runs(chunks of array).
* @param array : The origin array which is to be sorted.
* @param start : Starting index of the first run(chunk).
* @param mid : The ending index of the first run(chunk).
* @param end : Ending index of the second run(chunk).
* @param array: The origin array which is to be sorted.
* @param start: Starting index of the first run(chunk).
* @param mid: The ending index of the first run(chunk).
* @param end: Ending index of the second run(chunk).
*/

public void merge_runs(int array[], int start, int mid, int end) {
Expand Down Expand Up @@ -212,4 +211,3 @@ public static void main(String[] args) {
test();
}
}