Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 1 addition & 3 deletions Example_v0.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package controller;

import java.util.Random;
package sample;

public class A {
private static int Z;
Expand Down
18 changes: 9 additions & 9 deletions HeapSort.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Heap {
* @param y associated array
* @param n problem size
*/
public void sortHeap (String[] x, String[] y, int n ) {
public static void sortHeap (String[] x, String[] y, int n ) {
this.construct(x,y,n);
this.sort(x,y,n);
}
Expand All @@ -25,7 +25,7 @@ public void sortHeap (String[] x, String[] y, int n ) {
* @param y associated array
* @param n problem size
*/
public void sortHeap (String[] x, Integer[] y, int n ) {
public static void sortHeap (String[] x, Integer[] y, int n ) {
this.construct(x,y,n);
this.sort(x,y,n);
}
Expand All @@ -36,7 +36,7 @@ public void sortHeap (String[] x, Integer[] y, int n ) {
* @param y associated array
* @param n problem size
*/
private void construct(String[] x, String[] y, int n){
private static void construct(String[] x, String[] y, int n){

for (int i = (n-1)/2; i >= 0; i--){
int index = i;
Expand Down Expand Up @@ -65,7 +65,7 @@ private void construct(String[] x, String[] y, int n){
* @param y associated array
* @param n problem size
*/
private void construct(String[] x, Integer[] y, int n){
private static void construct(String[] x, Integer[] y, int n){

for (int i = (n-1)/2; i >= 0; i--){
int index = i;
Expand Down Expand Up @@ -94,7 +94,7 @@ private void construct(String[] x, Integer[] y, int n){
* @param y associated array
* @param n size of input array
*/
private void sort(String[] x, String[] y, int n){
private static void sort(String[] x, String[] y, int n){

int end = n - 1;
while (end > 0){
Expand Down Expand Up @@ -128,7 +128,7 @@ private void sort(String[] x, String[] y, int n){
* @param y associated array
* @param n size of input array
*/
private void sort(String[] x, Integer[] y, int n){
private static void sort(String[] x, Integer[] y, int n){

int end = n - 1;
while (end > 0){
Expand Down Expand Up @@ -156,7 +156,7 @@ private void sort(String[] x, Integer[] y, int n){
}
}

private String lower(String str){
private static String lower(String str){
String lowercase = "";
for (int i = 0; i < str.length(); i++){
lowercase += java.lang.Character.toLowerCase(str.charAt(i));
Expand All @@ -172,7 +172,7 @@ private String lower(String str){
* @param a index of first element
* @param b index of second element
*/
private void exchange(Comparable[] x, Comparable[] y, int a, int b){
private static void exchange(Comparable[] x, Comparable[] y, int a, int b){
Comparable temp = x[a];
x[a] = x[b];
x[b] = temp;
Expand All @@ -188,7 +188,7 @@ private void exchange(Comparable[] x, Comparable[] y, int a, int b){
* @param n length of array
* @return true if sorted, otherwise false
*/
private boolean isSorted(String[] x, int n){
private static boolean isSorted(String[] x, int n){
for (int i = 0; i < n - 1; i++){
if (lower(x[i]).compareTo(lower(x[i+1])) > 0) {
return false;
Expand Down