Skip to content

Commit

Permalink
Restructured the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
varunu28 committed Nov 13, 2018
1 parent fdc887e commit 819b7fd
Show file tree
Hide file tree
Showing 30 changed files with 59 additions and 222 deletions.
7 changes: 0 additions & 7 deletions .classpath

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/bin/
.idea/*
.classpath*
.project*
*.iml
17 changes: 0 additions & 17 deletions .project

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package search;
package Searches;

import java.util.Arrays;
import java.util.Random;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package search;
package Searches;

import java.util.Arrays;
import java.util.Random;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package search;
package Searches;

import java.util.Arrays;
import java.util.Random;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package search;
package Searches;

import java.util.Arrays;
import java.util.Random;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package search;
package Searches;

import java.util.Random;
import java.util.stream.Stream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package search;
package Searches;

import java.util.Scanner;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package search;
package Searches;

/**
* The common interface of most searching algorithms
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package search;
package Searches;


import java.util.Arrays;
Expand Down
137 changes: 0 additions & 137 deletions SkylineProblem/SkylineProblem.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package sort;
package Sorts;

import static sort.SortUtils.less;
import static sort.SortUtils.print;
import static Sorts.SortUtils.less;
import static Sorts.SortUtils.print;

/**
*
Expand Down
12 changes: 5 additions & 7 deletions Sorts/src/sort/BogoSort.java → Sorts/BogoSort.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package sort;
package Sorts;

import java.util.Random;

import static sort.SortUtils.*;


/**
*
Expand All @@ -19,7 +17,7 @@ public class BogoSort implements SortAlgorithm {

private static <T extends Comparable<T>> boolean isSorted(T array[]){
for(int i = 0; i<array.length - 1; i++){
if(less(array[i + 1], array[i])) return false;
if(SortUtils.less(array[i + 1], array[i])) return false;
}
return true;
}
Expand All @@ -30,7 +28,7 @@ private static <T> void nextPermutation(T array[]){

for (int i = 0; i < array.length; i++) {
int randomIndex = i + random.nextInt(length - i);
swap(array, randomIndex, i);
SortUtils.swap(array, randomIndex, i);
}
}

Expand All @@ -49,11 +47,11 @@ public static void main(String[] args) {
BogoSort bogoSort = new BogoSort();

// print a sorted array
print(bogoSort.sort(integers));
SortUtils.print(bogoSort.sort(integers));

// String Input
String[] strings = {"c", "a", "e", "b","d"};

print(bogoSort.sort(strings));
SortUtils.print(bogoSort.sort(strings));
}
}
4 changes: 2 additions & 2 deletions Sorts/src/sort/BubbleSort.java → Sorts/BubbleSort.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package sort;
package Sorts;

import static sort.SortUtils.*;
import static Sorts.SortUtils.*;

/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package sort;

import static sort.SortUtils.*;
package Sorts;

/**
*
Expand Down Expand Up @@ -29,17 +27,17 @@ public <T extends Comparable<T>> T[] sort(T[] array) {
// front
swappedRight = 0;
for (int i = left; i < right; i++) {
if (less(array[i + 1], array[i])) {
swap(array, i, i + 1);
if (SortUtils.less(array[i + 1], array[i])) {
SortUtils.swap(array, i, i + 1);
swappedRight = i;
}
}
// back
right = swappedRight;
swappedLeft = length - 1;
for (int j = right; j > left; j--) {
if (less(array[j], array[j - 1])) {
swap(array, j - 1, j);
if (SortUtils.less(array[j], array[j - 1])) {
SortUtils.swap(array, j - 1, j);
swappedLeft = j;
}
}
Expand All @@ -56,11 +54,11 @@ public static void main(String[] args) {
CocktailShakerSort shakerSort = new CocktailShakerSort();

// Output => 1 4 6 9 12 23 54 78 231
print(shakerSort.sort(integers));
SortUtils.print(shakerSort.sort(integers));

// String Input
String[] strings = { "c", "a", "e", "b", "d" };
print(shakerSort.sort(strings));
SortUtils.print(shakerSort.sort(strings));
}


Expand Down
4 changes: 2 additions & 2 deletions Sorts/src/sort/CombSort.java → Sorts/CombSort.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package sort;
package Sorts;

import static sort.SortUtils.*;
import static Sorts.SortUtils.*;


/**
Expand Down
4 changes: 2 additions & 2 deletions Sorts/src/sort/CountingSort.java → Sorts/CountingSort.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package sort;
package Sorts;

import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;

import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
import static sort.SortUtils.print;
import static Sorts.SortUtils.print;

/**
*
Expand Down
6 changes: 3 additions & 3 deletions Sorts/src/sort/CycleSort.java → Sorts/CycleSort.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package sort;
package Sorts;

import static sort.SortUtils.less;
import static sort.SortUtils.print;
import static Sorts.SortUtils.less;
import static Sorts.SortUtils.print;

/**
* @author Podshivalov Nikita (https://github.com/nikitap492)
Expand Down
4 changes: 2 additions & 2 deletions Sorts/src/sort/GnomeSort.java → Sorts/GnomeSort.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package sort;
package Sorts;

import static sort.SortUtils.*;
import static Sorts.SortUtils.*;

/**
* Implementation of gnome sort
Expand Down
4 changes: 2 additions & 2 deletions Sorts/src/sort/HeapSort.java → Sorts/HeapSort.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package sort;
package Sorts;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static sort.SortUtils.*;
import static Sorts.SortUtils.*;

/**
* Heap Sort Algorithm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package sort;
package Sorts;

import static sort.SortUtils.less;
import static sort.SortUtils.print;
import static Sorts.SortUtils.less;
import static Sorts.SortUtils.print;

/**
*
Expand Down
Loading

0 comments on commit 819b7fd

Please sign in to comment.