Skip to content

Create a new Strand Sort Algorithm #3205

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 7 commits into from
Aug 6, 2022
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Change access to static using StrandSort
  • Loading branch information
MarcusCody authored Aug 3, 2022
commit eeaf70b343ad0342e140a566d74d3d7ad486a674
23 changes: 12 additions & 11 deletions src/test/java/com/thealgorithms/sorts/StrandSortTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,31 @@

public class StrandSortTest {
@Test
// valid test case
public void StrandSortNonDuplicateTest() {
StrandSort strand = new StrandSort();
int[] expectedArray = {1,2,3,4,5};
LinkedList<Integer> actualList = strand.strandSort(new LinkedList<Integer>(Arrays.asList(3,1,2,4,5)));
// valid test case
public void StrandSortNonDuplicateTest() {
int[] expectedArray = { 1, 2, 3, 4, 5 };
LinkedList<Integer> actualList = StrandSort.strandSort(new LinkedList<Integer>(Arrays.asList(3, 1, 2, 4, 5)));
int[] actualArray = new int[actualList.size()];
for(int i=0; i<actualList.size(); i++) {
for (int i = 0; i < actualList.size(); i++) {
actualArray[i] = actualList.get(i);
}
assertArrayEquals(expectedArray, actualArray);

}

@Test
// valid test case
// valid test case
public void StrandSortDuplicateTest() {
StrandSort strand = new StrandSort();
int[] expectedArray = {2, 2, 2, 5, 7};
LinkedList<Integer> actualList = strand.strandSort(new LinkedList<Integer>(Arrays.asList(7, 2, 2, 2, 5)));
int[] expectedArray = { 2, 2, 2, 5, 7 };
LinkedList<Integer> actualList = StrandSort.strandSort(new LinkedList<Integer>(Arrays.asList(7, 2, 2, 2, 5)));
int[] actualArray = new int[actualList.size()];
for(int i=0; i<actualList.size(); i++) {
for (int i = 0; i < actualList.size(); i++) {
actualArray[i] = actualList.get(i);
}
assertArrayEquals(expectedArray, actualArray);

}

}