This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
public class BubbleSort { | |
public static int[] data = new int[]{1, 8, 2, 7, 3, 4, 7, 6}; | |
public static void main(String[] args) { | |
sort(); | |
System.out.println(Arrays.toString(data)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
public class Reverse { | |
private static int[] data = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; | |
public static void main(String[] args) { | |
reverse(); | |
System.out.println(Arrays.toString(data)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.util.stream.Stream; | |
import static java.util.stream.Collectors.toList; | |
public class SearchBreadthDepth { | |
/** | |
node5 | |
node3 node4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SelectionSearch { | |
private static int[] data = new int[]{9, 1, 43, 5, 20, 50, 7, 22, 43, 17, 47}; | |
public static void main(String[] args) { | |
System.out.println(Arrays.toString(data)); | |
selectionSort(); | |
System.out.println(Arrays.toString(data)); | |
} | |
public static void selectionSort() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SelectionSearch { | |
private static int[] data = new int[]{9, 1, 43, 5, 20, 50, 7, 22, 43, 17, 47}; | |
public static void main(String[] args) { | |
System.out.println(Arrays.toString(data)); | |
insertionSort(); | |
System.out.println(Arrays.toString(data)); | |
} | |
public static void insertionSort() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
public class App { | |
public static void main(String[] args) { | |
List<Vertex> vertexList = new ArrayList<>(); | |
vertexList.add(new Vertex("A")); | |
vertexList.add(new Vertex("B")); | |
vertexList.add(new Vertex("C")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BinaryTree { | |
private Node root; | |
public void addNode(int key, String name) { | |
Node newNode = new Node(key, name); | |
if (root == null) { | |
root = newNode; | |
} else { | |
Node focusNode = root; | |
Node parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Permutation { | |
public static void main(String[] args) { | |
permutation("ABC"); | |
} | |
public static void permutation(String str) { | |
permutation("", str); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
public class QuickSort { | |
private static int[] data = new int[]{19, 43, 35, 20, 50, 47, 42, 43, 47, 47}; | |
public static void main(String[] args) { | |
System.out.println(Arrays.toString(data)); | |
sort(); | |
System.out.println(Arrays.toString(data)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
public class CommonInteger { | |
public static void main(String[] args) { | |
int[] data1 = new int[]{13, 27, 35, 40, 49, 55, 59}; | |
int[] data2 = new int[]{17, 35, 39, 40, 41, 42, 43, 44, 45, 55, 58, 60}; | |
List<Integer> matchList = findCommonInt(data1, data2); | |
System.out.println(matchList); | |
} |
OlderNewer