Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Homnay1234 patch 1#22

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
homnay1234 wants to merge3 commits intorampatra:master
base:master
Choose a base branch
Loading
fromhomnay1234:homnay1234-patch-1
Open
Show file tree
Hide file tree
Changes fromall commits
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
36 changes: 36 additions & 0 deletionsTestSelectionSort
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;

class TestSort {

SelectionSort selectionSort = new SelectionSort();
@Test
public void tesInsertIntoSorted() {
int[] inputArr = new int[] {1,3,5};
int[] inputResult = new int[] {1,3,5};
selectionSort.selectionSort(inputArr);
assertArrayEquals(inputResult, inputArr);
}

SelectionSort selectionSort2 = new SelectionSort();
@Test
public void tesInsertIntoSorted2() {
int[] inputArr = new int[] {5,3,1};
int[] inputResult = new int[] {1,3,5};
selectionSort.selectionSort(inputArr);
assertArrayEquals(inputResult, inputArr);
}


SelectionSort selectionSort3 = new SelectionSort();
@Test
public void tesInsertIntoSorted3() {
int[] inputArr = new int[] {4,5,3,2};
int[] inputResult = new int[] {2,3,4,5};
selectionSort.selectionSort(inputArr);
assertArrayEquals(inputResult, inputArr);
}


}
6 changes: 1 addition & 5 deletionssrc/main/java/com/rampatra/searching/BinarySearch.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,10 +72,6 @@ public static void main(String[] args) {
System.out.println(binarySearch(new int[]{0, 2}, 0));
System.out.println(binarySearch(new int[]{0, 1, 2, 2, 2, 3, 3}, 2)); // doesn't return index of first occurrence
System.out.println("---------");
System.out.println(binarySearchNonRecursive(new int[]{0, 2}, 2));
System.out.println(binarySearchNonRecursive(new int[]{0, 1, 2, 3}, 2));
System.out.println(binarySearchNonRecursive(new int[]{0, 1, 2, 3}, 3));
System.out.println(binarySearchNonRecursive(new int[]{0, 2}, 0));
System.out.println(binarySearchNonRecursive(new int[]{0, 1, 2, 2, 2, 3, 3}, 2));

}
}

[8]ページ先頭

©2009-2025 Movatter.jp