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
DROP TABLE IF EXISTS `Classes`; | |
CREATE TABLE `Classes` ( | |
`class` varchar(20), | |
`type` varchar(2), | |
`country` varchar(20), | |
`numGuns` int(11), | |
`bore` int(11), | |
`displacement` int(11) | |
); | |
INSERT INTO `Classes` VALUES |
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
class Main { | |
public static void main(String[] args) { | |
int input = Integer.parseInt(args[0]); | |
System.out.println("You entered: "+input); | |
} | |
} |
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; | |
class MergeSort{ | |
public static void main(String[] args) { | |
Integer[] data = {305, 65, 7, 90, 120, 110, 8}; | |
mergeSort(data); | |
System.out.println(Arrays.toString(data)); | |
} | |
public static <T extends Comparable<T>> |
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
class Main { | |
public static void main(String[] args) { | |
System.out.println("expect: 5"); | |
System.out.println("got: "+sqrt(25)); | |
System.out.println("expect: -1"); | |
System.out.println("got: "+sqrt(-1)); | |
System.out.println("expect: 0"); | |
System.out.println("got: "+sqrt(0)); | |
System.out.println("expect: 1"); | |
System.out.println("got: "+sqrt(1)); |
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
#lang racket | |
;; This is a new version of pmatch (August 8, 2012). | |
;; It has two important new features: | |
;; 1. It allows for a name to be given to the pmatch if an error ensues. | |
;; 2. A line from the specification has been removed. (see below). Without | |
;; that line removed, it was impossible for a pattern to be (quote ,x), | |
;; which might be worth having especially when we write an interpreter | |
;; for Scheme, which includes quote as a language form. |
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.LinkedList; | |
import java.util.Iterator; | |
public class MyTreeSet{ | |
MyTreeMap map = new MyTreeMap(); | |
public void add(String key){ | |
// TO BE IMPLEMENTED | |
// return false; | |
// add key to set |
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.LinkedList; | |
import java.util.Iterator; | |
import tree.LinkedBinarySearchTree; | |
public class MyTreeMap{ | |
LinkedBinarySearchTree<Element> tree = | |
new LinkedBinarySearchTree<Element>(); | |
public LinkedList<Integer> put(String key, Integer location){ | |
Element element = new Element(key, null); |
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
/* lessons learned: | |
- Test the base cases | |
- Use multiple debugging code and sources | |
- Make sure to think of other base cases or problems beforehand on the input side outside of the test cases given | |
*/ | |
import java.util.Scanner; | |
import java.io.File; | |
import java.io.FileNotFoundException; |
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 EditorException extends RuntimeException{ | |
private String message = null; | |
public EditorException(){} | |
public EditorException(String message){ | |
super(); | |
this.message = message; | |
} |
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.Scanner; | |
import java.util.LinkedList; | |
import java.util.Iterator; | |
import java.util.NoSuchElementException; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.PrintWriter; | |
public class Editor{ | |
LinkedList<String> list; |
NewerOlder