Skip to content

Instantly share code, notes, and snippets.

View khayyamsaleem's full-sized avatar
🏠
Working from home

khayyam khayyamsaleem

🏠
Working from home
View GitHub Profile
import java.util.Queue;
import java.util.LinkedList;
/**
* Binary Tree Stub for Recitation
* @author khayyamsaleem
*/
public class BinaryTree<E extends Comparable<E>>{
Node<E> root; //root of the whole tree
import java.util.AbstractQueue;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Comparator;
import java.util.Queue;
/**
* The Heap implements the Queue interface
* by building a heap in an ArrayList. The heap is structured
* so that the "smallest" item is at the top.
* @author Koffman and Wolfgang
import java.util.ArrayList;
import java.util.Collections;
/**
* Java implementation of a minHeap <br>
* Challenge (not really): convert to maxHeap <br>
* Challenge: implement a swap function for arraylists
* so that we don't have to import Collections <br>
* Challenge: use an Array instead of an ArrayList (hard) <br>
* Challenge: rewrite toString to prettyPrint a heap
* @author: Khayyam Saleem
%Khayyam Saleem and Ryan Edelstein
%CS511 Quiz 6
%We pledge our honors that we have abided by the Stevens Honor System.
-module(tree_quiz).
-compile(export_all).
b_and(true, true) -> true;
b_and(_, _) -> false.
tSize({empty}) -> 0;
import java.util.Queue;
import java.util.ArrayList;
import java.util.LinkedList;
public class BinaryTree<E extends Comparable<E>>{
Node<E> root; //root of the whole tree
/**
* inner node class for BTs
*/
-module(interp).
-export([scanAndParse/1,runFile/1,runStr/1,scanAndParseString/1]).
-include("types.hrl").
loop(InFile,Acc) ->
case io:request(InFile,{get_until,prompt,lexer,token,[1]}) of
{ok,Token,_EndLine} ->
loop(InFile,Acc ++ [Token]);
{error,token} ->
exit(scanning_error);
-module(env).
-compile(export_all).
-include("types.hrl").
-spec new()-> envType().
new() ->
[].
-spec add(envType(),atom(),valType())-> envType().
-module(interp).
-export([scanAndParse/1,runFile/1,runStr/1,scanAndParseString/1]).
-include("types.hrl").
loop(InFile,Acc) ->
case io:request(InFile,{get_until,prompt,lexer,token,[1]}) of
{ok,Token,_EndLine} ->
loop(InFile,Acc ++ [Token]);
{error,token} ->
exit(scanning_error);
-module(interp).
-export([scanAndParse/1,runFile/1,runStr/1,scanAndParseString/1]).
-include("types.hrl").
loop(InFile,Acc) ->
case io:request(InFile,{get_until,prompt,lexer,token,[1]}) of
{ok,Token,_EndLine} ->
loop(InFile,Acc ++ [Token]);
{error,token} ->
exit(scanning_error);
html {
font-family: 'helvetica, sans-serif'
}
h1, h2{
color: #1B4D3E;
}
h2{
color: #2E8B57;
}