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; | |
public class InsertionSort { | |
public static void linearSearch(int[] array, int key) { | |
insertionSort(array); | |
boolean foundFlag = false; | |
for (int i = 0; i < array.length; i++) { | |
if (array[i] == key) { |
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
package labone.insertionsort; | |
import java.util.Scanner; | |
public class InsertionSort { | |
public static void linearSearch(int[] array, int key) { | |
insertionSort(array); | |
boolean foundFlag = false; | |
for (int i = 0; i < array.length; i++) { |
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
package labone.insertionsort; | |
import java.util.Scanner; | |
public class InsertionSort { | |
public static void linearSearch(int[] array, int key) { | |
insertionSort(array); | |
boolean foundFlag = false; | |
for (int i = 0; i < array.length; i++) { |
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
/* | |
This script is pretty basic, but if you use it, please let me know. Thanks! | |
Andrew Hedges, andrew(at)hedges(dot)name | |
*/ | |
var Haversine = { | |
Rm : 3961, // mean radius of the earth (miles) at 39 degrees from the equator | |
Rk : 6373, // mean radius of the earth (km) at 39 degrees from the equator | |
// convert degrees to radians |
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 math | |
import random | |
def coin_flip(flip_count): | |
total_in_circle = 0.0 | |
for i in range(0, int(flip_count)): | |
x_coord = random.uniform(-1.0, 1.0) |
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 base64 | |
import hmac | |
import json | |
import requests | |
import time | |
import urllib | |
import os | |
from hashlib import sha1 | |
from hashlib import md5 |
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 Food { | |
protected double price; | |
protected double quantity; | |
protected double volume; | |
protected double weight; | |
protected String foodType; | |
protected String volUnit; | |
protected String weightUnit; |
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
package labthree.heapsort; | |
import java.util.Arrays; | |
import java.util.Comparator; | |
public class Driver { | |
private static long timeInitial; | |
private static long timeFinal; | |
private static long timeElapsed; |
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 BST<T extends Comparable<T>> extends BinaryTree<T> { | |
public void insert(BinaryTreeNode<T> z) { | |
BinaryTreeNode<T> y = null; | |
BinaryTreeNode<T> x = this.getRoot(); | |
while (x != null) { | |
y = x; | |
x = (z.getData().compareTo(x.getData()) == -1) | |
? x.getLeft() | |
: x.getRight(); |
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; | |
@SuppressWarnings("serial") | |
public class BubbleSort<T> extends ArrayList<T> implements Comparable<T>{ | |
@SuppressWarnings("unchecked") | |
public <T extends Comparable<T>> void sort() { | |
int n = this.size(); | |
boolean swapped = false; |