SlideShare a Scribd company logo
1 of 169
Hierarchies of LifeExperiment 1: Classification of Common
Objects
Data Tables (15 points)
Post-Lab Questions
1. Did you find that the items grouped together as you worked
down the flow chart had similar characteristics in terms of their
appearance? What about function? (10 points)
A lot of the groups had similar characteristics and function,
until I looked deeper into then as I continued down the list of
questions. For example, a candle and a Scentsy are similar in
function and characteristics, as they both give off pleasant
smells. But if you were to ask if they use fire, you’d be able to
differentiate the two.
2. Do you feel that the questions asked were appropriate? What
questions would you have asked to devise this classification
flow chart? What objects would be grouped together with your
system? (10 points)
I had to look over the chart a few times and soon made sense of
the flow. I found myself conflicted on some of the answers as
well, not agreeing with some entirely. For example, I don’t
think a hex nut is cylindrical or round. It has sides, similar to
pens and pencils where the style if hex like.
3. Do you think it is more or less challenging to classify living
organisms in comparison to objects? Why? (10 points)
4. Pick 10 household items (e.g. spoon, book, paper clip, etc.)
and design a taxonomic classification system to categorize
them, similar to the one in Figure 8. Make sure you ask enough
yes/no questions so that each item ends up in its own box or
category at the end. (10 points)
Experiment 2: Classification of Organisms
Data Tables (10 points)
Table 2: Classification of Organisms
Organism
Domain
Kingdom
Defined Nucleus
Mobile
Photosynthesis
Unicellular
Salmonella
Bacteria
Genus
No
Yes
Yes
Yes
Ants
Eukarya
Animalia
Yes
Yes
No
No
Zoo Flagellate
Eukarya
Protozoa
Yes
Yes
No
Yes
Wolf
Eukarya
Animalia
Yes
Yes
No
No
Morning Glory
Eukarya
Plantae
Yes
No
Yes
No
Euglena
Eukarya
Protozoa
Yes
Yes
Yes
Yes
Shiitake
Eukarya
Fungi
Yes
No
No
No
Pseudomonas
Bacteria
Bacteria
No
Yes
No
Yes
Spruce
Eukarya
Planta
Yes
No
Yes
No
Death Cap Mushroom
Eukarya
Fungi
Yes
No
No
No
Post-Lab Questions
1. Did this series of questions correctly organize each
organism? Why or why not? (10 points)
2. Do you feel that the questions asked were appropriate? What
questions would you have asked? (10 points)
3. Which kingdom do you believe is most challenging to
categorize correctly? Explain your answer (10 points)
©eScience Labs, LLC 2018
a1-code/save_deltas.o
a1-code/test_print_graph_data.sh
#!/bin/bash
T=0 # global test number
((T++))
tnames[T]="demo-test"
#
read -r -d '' output[$T] <<"ENDOUT"
DEMO DATA 1
===========
length: 22
min: 0
max: 20
range: 20
max_height: 10
units_per_height: 2.00
+----+----+----+----+-
20 | X
18 | XX
16 | XXX
14 | XXXX
12 | XXXXX
10 | X XXXXXXX
8 | XXX XXXXXXXX
6 | XXXXX XXXXXXXXX
4 | XXXXXXX XXXXXXXXXX
2 | XXXXXXXXXXXXXXXXXXXX
0 |XXXXXXXXXXXXXXXXXXXXXX
+----+----+----+----+-
0 5 10 15 20
DEMO DATA 2
===========
length: 22
min: 0
max: 20
range: 20
max_height: 20
units_per_height: 1.00
+----+----+----+----+-
20 | X
19 | X
18 | XX
17 | XX
16 | XXX
15 | XXX
14 | XXXX
13 | XXXX
12 | XXXXX
11 | XXXXX
10 | X XXXXXXX
9 | XX XXXXXXX
8 | XXX XXXXXXXX
7 | XXXX XXXXXXXX
6 | XXXXX XXXXXXXXX
5 | XXXXXX XXXXXXXXX
4 | XXXXXXX XXXXXXXXXX
3 | XXXXXXXX XXXXXXXXXX
2 | XXXXXXXXXXXXXXXXXXXX
1 | XXXXXXXXXXXXXXXXXXXXX
0 |XXXXXXXXXXXXXXXXXXXXXX
+----+----+----+----+-
0 5 10 15 20
DEMO DATA 3
===========
length: 50
min: 13
max: 996
range: 983
max_height: 10
units_per_height: 98.30
+----+----+----+----+----+----+----+----+----+----
996 | X
897 | X X X X
799 | X X X X X X X X X
701 | XX X X X XXX X XX XXX X X XX
602 | XX X X XX XXX X X XX XXXX XX X XX
504 | XX XXX XX XXX XX X XXX XXXX XX XX X
XX
406 | XX X XXX XXXX XXX XX X XXX XXX
XXXXXXXXXX X XX
307 | XXX X XXX XXXXXXXXXXX X XXXX
XXXXXXXXXXXXXXX X XX
209 | XXX XXXXXXXXXXXXXXXXX XXXXXX
XXXXXXXXXXXXXXXXX XX
111 |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXX
13
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXX
+----+----+----+----+----+----+----+----+----+----
0 5 10 15 20 25 30 35 40 45
DEMO DATA 4
===========
length: 50
min: 13
max: 996
range: 983
max_height: 18
units_per_height: 54.61
+----+----+----+----+----+----+----+----+----+----
996 | X
941 | X X
886 | X X X X
832 | X X X X X X
777 | X X X X XXX X X XXX XX
722 | XX X X X XXX X X XXX XX
668 | XX X X X XXX X XX XXXX X X XX
613 | XX X X XX XXX X XX XXXX XX X XX
559 | XX XXX XX XXX XX X XX XXXX X XX X XX
504 | XX XXX XX XXX XX X XXX XXXX XX XX X
XX
449 | XX X XXX XXXX XXX XX X X XXX XXXX XX XX
X XX
395 | XXX X XXX XXXX XXX XX X XXX XXX
XXXXXXXXXX X XX
340 | XXX X XXX XXXXXXXXXXX X XXX
XXXXXXXXXXXXXXX X XX
286 | XXX X XXX XXXXXXXXXXX X XXXX
XXXXXXXXXXXXXXX X XX
231 | XXX X XXXXXXXXXXXXXXX XXXXXX
XXXXXXXXXXXXXXXXX XX
176 | XXX XXXXXXXXXXXXXXXXX XXXXXX
XXXXXXXXXXXXXXXXXXXX
122 |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXX
67 |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXX
13
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXX
+----+----+----+----+----+----+----+----+----+----
0 5 10 15 20 25 30 35 40 45
ENDOUT
__MACOSX/a1-code/._test_print_graph_data.sh
a1-code/.DS_Store
__MACOSX/a1-code/._.DS_Store
a1-code/print_graph_demo.c
#include <stdio.h>
void print_graph(int *data, int len, int max_height);
int main(int argc, char *argv[]){
printf("DEMO DATA 1n");
printf("===========n");
int data1[22] =
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 10,};
int len1 = 22;
print_graph(data1, len1, 10);
printf("n");
printf("DEMO DATA 2n");
printf("===========n");
print_graph(data1, len1, 20);
printf("n");
printf("DEMO DATA 3n");
printf("===========n");
int data2[50] = {
13 , 397, 813, 745, 154, 473, 212, 939, 593, 849, 247, 453,
662, 806,
478, 390, 996, 792, 929, 372, 603, 577, 146, 801, 276, 328,
422, 481,
438, 126, 701, 988, 555, 376, 674, 781, 795, 780, 415, 521,
581, 412,
701, 617, 367, 258, 704, 192, 869, 791,
};
int len2 = 50;
print_graph(data2, len2, 10);
printf("n");
printf("DEMO DATA 4n");
printf("===========n");
print_graph(data2, len2, 18);
printf("n");
return 0;
}
__MACOSX/a1-code/._print_graph_demo.c
a1-code/deltas.txt
10 2 5 -2 -5 -5 -6 4
a1-code/test_hash_main.sh
#!/bin/bash
# tests for print_graph_demo, run as one of
# > ./test_tree_main.sh # run everything
# > ./test_tree_main.sh 2 # run only tests 2
#
# 15 points for tests
# 5 points for valgrind tests
function major_sep(){
printf '%sn'
'====================================='
}
function minor_sep(){
printf '%sn' '-------------------------------------'
}
major_sep
printf "PROBLEM 3 hash_main.cn"
generate=1
run_norm=1 # run normal tests
run_valg=1 # run valgrind tests
valg_denom=3 # divide valgrind score by
this for points
# Determine column width of the terminal
if [[ -z "$COLUMNS" ]]; then
printf "Setting COLUMNS based on sttyn"
COLUMNS=$(stty size | awk '{print $2}')
fi
if (($COLUMNS == 0)); then
COLUMNS=126
fi
printf "COLUMNS is $COLUMNSn"
DIFF="diff -bBy -W $COLUMNS" # -b ignore
whitespace, -B ignore blank lines, -y do side-by-side
comparison, -W to increase width of columns
VALGRIND="valgrind --leak-check=full --show-leak-
kinds=all"
INPUT=test-data/input.tmp # name for expected
output file
EXPECT=test-data/expect.tmp # name for expected
output file
ACTUAL=test-data/actual.tmp # name for actual
output file
DIFFOUT=test-data/diff.tmp # name for diff output
file
VALGOUT=test-data/valgrind.tmp # name for valgrind
output file
printf "Loading tests... "
source test_hash_main_data.sh
printf "%d tests loadedn" "$T"
NTESTS=$T
VTESTS=$T
NPASS=0
NVALG=0
all_tests=$(seq $NTESTS)
case "$1" in
norm)
run_valg=0
shift
;;
valg)
run_norm=0
shift
;;
esac
# Check whether a single test is being run
single_test=$1
if ((single_test > 0 && single_test <= NTESTS)); then
printf "Running single TEST %dn" "$single_test"
all_tests=$single_test
NTESTS=1
VTESTS=1
else
printf "Running %d testsn" "$NTESTS"
fi
# printf "tests: %sn" "$all_tests"
printf "n"
# Run normal tests: capture output and check against expected
if [ "$run_norm" = "1" ]; then
minor_sep
printf "hash_main NORMAL TESTSn"
for i in $all_tests; do
printf "TEST %2d %-18s : " "$i" "${tnames[i]}"
FAIL="0"
# Run the test
# run program with given input
{ printf "%sn" "${input[i]}" | ./hash_main -echo ; } >&
$ACTUAL
# generate expected output
printf "%sn" "${output[i]}" > $EXPECT
# Check for output differences, print side-by-side diff if
problems
if ! $DIFF $EXPECT $ACTUAL > $DIFFOUT
then
printf "FAIL: Output Incorrectn"
minor_sep
printf "INPUT:n%sn" "${input[i]}"
# Mac OSX has a different version sed so use awk to
add on the ACTUAL/EXPECT
$DIFF <(awk 'BEGIN{print "***EXPECT
OUTPUT***"} {print}' $EXPECT) <(awk 'BEGIN{print
"***ACTUAL OUTPUT***"} {print}' $ACTUAL) >
$DIFFOUT # regen the diff with the headers
cat $DIFFOUT
if [ "$generate" == "1" ]; then
printf "%sn" "---FULL ACTUAL---"
cat $ACTUAL
echo
fi
minor_sep
FAIL="1"
fi
if [ -n "${tfiles[i]}" ]; then # if there is an
output file to check
TEXPECT=test-data/texpect.tmp # name for
expected output file
TACTUAL="${tfiles[i]}" # name for
actual output file
TDIFFOUT=test-data/tdiff.tmp # name for
diff output file
# generate expected output
printf "%sn" "${tfiles_expect[i]}" > $TEXPECT
# Check for output differences, print side-by-side diff if
problems
if ! $DIFF $TEXPECT $TACTUAL > $TDIFFOUT
then
printf "FAIL: File %s incorrectn" "$TACTUAL"
minor_sep
printf "INPUT:n%sn" "${input[i]}"
printf "OUTPUT: EXPECT vs ACTUALn"
cat $TDIFFOUT
if [ "$generate" == "1" ]; then
printf "%sn" "---FULL ACTUAL---"
cat $TACTUAL
fi
minor_sep
FAIL="1"
fi
fi
if (( FAIL == 0 )); then
printf "OKn"
((NPASS++))
fi
done
printf "Finished:n"
printf "%2d / %2d Normal correctn" "$NPASS" "$NTESTS"
printf "n"
fi
#
===============================================
=================================
# Run valgrind tests: check only for problems identified by
valgrind
if [ "$run_valg" = "1" ]; then
minor_sep
printf "hash_main.c VALGRIND TESTSn"
for i in $all_tests; do
printf "TEST %2d %-18s : " "$i" "${tnames[i]}"
# run code through valgrind
{ printf "%sn" "${input[i]}" | $VALGRIND ./hash_main -
echo ; } >& $VALGOUT
# Check various outputs from valgrind
if ! grep -q 'ERROR SUMMARY: 0 errors from 0 contexts
(suppressed: 0 from 0)' $VALGOUT ||
! grep -q 'in use at exit: 0 bytes in 0 blocks'
$VALGOUT ||
grep -q 'definitely lost: 0 bytes in 0 blocks'
$VALGOUT;
then
printf "FAIL: Valgrind detected problemsn"
minor_sep
cat $VALGOUT
minor_sep
else
printf "Valgrind OKn"
((NVALG++))
fi
done
printf "Finished:n"
printf "%2d / %2d Valgrind correctn" "$NVALG"
"$VTESTS"
printf "n"
fi
NVALG=$((NVALG / valg_denom))
VTESTS=$((VTESTS / valg_denom))
major_sep
printf "OVERALL:n"
printf "%2d / %2d Normal correctn" "$NPASS" "$NTESTS"
printf "%2d / %2d Valgrind pointsn" "$NVALG" "$VTESTS"
printf "RESULTS: %d / %d points for normal/valgrind testsn"
"$((NPASS+NVALG))" "$((NTESTS+VTESTS))"
__MACOSX/a1-code/._test_hash_main.sh
a1-code/test-data/README
This directory is for files generated during testing. It must be
present for tests to work but the contents may be safely ignored.
Files in this directory may be safely removed. The provided
Makefile
target
make clean-tests
will do this.
__MACOSX/a1-code/test-data/._README
__MACOSX/a1-code/._test-data
a1-code/test_graph_file.sh
#!/bin/bash
#
# tests for graph_file executable, run as one of
# > ./test_graph_file.sh # run everything
# > ./test_graph_file.sh 2 # run only tests 2
# > ./test_graph_file.sh norm # run only normal tests
# > ./test_graph_file.sh valg # run only valgrind tests
# > ./test_graph_file.sh norm 2 # run only normal test 2
# > ./test_graph_file.sh valg 2 # run only vaglgrind test 2
#
# 1 point(s) per 10 normal tests
# 0-3 point(s) penalty for memory problems under Valgrind
function major_sep(){
printf '%sn'
'====================================='
}
function minor_sep(){
printf '%sn' '-------------------------------------'
}
# major_sep
# printf "PROBLEM 2B graph_file.cn"
generate=1
run_norm=1 # run normal tests
run_valg=1 # run valgrind tests
valg_penalty_max=3 # maximum point
deduction for valgrind problems
VALGRIND="valgrind --leak-check=full --show-leak-
kinds=all"
DIFF="diff -bBy" # -b ignore whitespace, -B
ignore blank lines, -y do side-by-side comparison
INPUT=test-data/input.tmp # name for expected
output file
EXPECT=test-data/expect.tmp # name for expected
output file
ACTUAL=test-data/actual.tmp # name for actual
output file
DIFFOUT=test-data/testdiff.tmp # name for diff output
file
VALGOUT=test-data/valgrind.tmp # name for valgrind
output file
printf "Loading tests... "
source test_graph_file_data.sh
printf "%d tests loadedn" "$T"
NTESTS=$T
VTESTS=$T
NPASS=0
NVALG=0
all_tests=$(seq $NTESTS)
# Turn off normal/valgrind test sections
case "$1" in
norm)
run_valg=0
shift
;;
valg)
run_norm=0
shift
;;
esac
# Check whether a single test is being run
single_test=$1
if ((single_test > 0 && single_test <= NTESTS)); then
printf "Running single TEST %dn" "$single_test"
all_tests=$single_test
NTESTS=1
VTESTS=1
else
printf "Running %d testsn" "$NTESTS"
fi
# printf "tests: %sn" "$all_tests"
printf "n"
# Run normal tests: capture output and check against expected
if [ "$run_norm" = "1" ]; then
minor_sep
printf "graph_file.c NORMAL TESTSn"
for i in $all_tests; do
printf "TEST %2d %-18s : " "$i" "${tnames[i]}"
# Run the test
# generate the input file
printf "%sn" "${input[i]}" | ./save_deltas "${format[i]}"
$INPUT > /dev/null
# run program on input file
{ ./graph_file "${format[i]}" $INPUT "${height[i]}" ; }
>& $ACTUAL
# generate expected output
printf "%sn" "${output[i]}" > $EXPECT
# Check for failure, print side-by-side diff if problems
if ! $DIFF $EXPECT $ACTUAL > $DIFFOUT
then
printf "FAIL: Output Incorrectn"
minor_sep
printf "INPUT:n%sn" "${input[i]}"
printf "OUTPUT: EXPECT vs ACTUALn"
cat $DIFFOUT
if [ "$generate" == "1" ]; then
printf "FULL ACTUALn"
cat $ACTUAL
fi
minor_sep
else
printf "OKn"
((NPASS++))
fi
done
printf "Finishedn"
printf "%2d / %2d Normal correctn" "$NPASS" "$NTESTS"
printf "n"
fi
#
===============================================
=================================
# Run valgrind tests: check only for problems identified by
valgrind
if [ "$run_valg" = "1" ]; then
minor_sep
printf "graph_file.c VALGRIND TESTSn"
for i in $all_tests; do
printf "TEST %2d %-18s : " "$i" "${tnames[i]}"
# Run the test
# generate the input file
printf "%sn" "${input[i]}" | ./save_deltas "${format[i]}"
$INPUT > /dev/null
# run code through valgrind
{ $VALGRIND ./graph_file "${format[i]}" $INPUT
"${height[i]}" ; } >& $VALGOUT
# Check various outputs from valgrind
if ! grep -q 'ERROR SUMMARY: 0 errors from 0 contexts
(suppressed: 0 from 0)' $VALGOUT ||
! grep -q 'in use at exit: 0 bytes in 0 blocks'
$VALGOUT ||
grep -q 'definitely lost: 0 bytes in 0 blocks'
$VALGOUT;
then
printf "FAIL: Valgrind detected problemsn"
minor_sep
cat $VALGOUT
minor_sep
else
printf "Valgrind OKn"
((NVALG++))
fi
done
printf "Finishedn"
printf "%2d / %2d Valgrind correctn" "$NVALG"
"$VTESTS"
printf "n"
fi
major_sep
printf "OVERALL:n"
printf "%2d / %2d Normal correctn" "$NPASS" "$NTESTS"
printf "%2d / %2d Valgrind correctn" "$NVALG" "$VTESTS"
valg_penalty=$((VTESTS-NVALG))
if ((valg_penalty > valg_penalty_max)); then
valg_penalty=$valg_penalty_max
fi
printf "Valgrind penalty: -%dn" "$valg_penalty"
SCORE=$((NPASS-valg_penalty))
if ((SCORE < 0)); then
SCORE=0;
fi
printf "RESULTS: %d / %d points for normal/valgrind testsn"
"$SCORE" "$NTESTS"
__MACOSX/a1-code/._test_graph_file.sh
a1-code/read_deltas.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "deltas.h"
#include <sys/types.h>
#include <sys/stat.h>
int *read_text_deltas(char *fname, int *len){
int num = 0;
int count = 0;
FILE *fp;
fp = fopen(fname,"r");
if(fp == NULL){
*len = -1;
return NULL;
}
while(!feof(fp)){
fscanf(fp,"%d", &num);
count++;
}
rewind(fp);
int *arr = (int*) malloc(count * sizeof(int));
int i=1;
fscanf(fp,"%d", &num);
arr[i - 1] = num;
while(!feof(fp)){
fscanf(fp,"%d", &num);
arr[i] = num;
//printf("%d %dn", i,arr[i-1] + num);
arr[i] = arr[i-1] + num;
i++;
}
*len = count - 1;
fclose(fp);
return arr;
}
int *read_int_deltas(char *fname, int *len){
struct stat buf;
int num = 0;
int result = stat(fname, &buf);
if(result == -1 || buf.st_size < sizeof(int)){
return NULL;
}
int size = buf.st_size / 4;
int *arr = (int*) malloc(size * sizeof(int));
FILE *fp;
fp = fopen(fname,"r");
if(fp == NULL){
*len = -1;
return NULL;
}
int i = 1;
fread(&num,sizeof(int),1,fp);
arr[i-1] = num;
for(i = 1; i < size; i++){
fread(&num,sizeof(int),1,fp);
//printf("%d %dn", i,arr[i-1] + num);
arr[i] = arr[i-1] + num;
}
*len = size;
fclose(fp);
return arr;
}
__MACOSX/a1-code/._read_deltas.c
a1-code/binary.int
a1-code/Makefile
CFLAGS = -Wall -g -lm
CC = gcc $(CFLAGS)
SHELL = /bin/bash
CWD = $(shell pwd | sed 's/.*///g')
PROGRAMS = 
save_deltas 
deltas_main 
print_graph_demo 
graph_file 
hash_main 
all : $(PROGRAMS)
AN=a1
zip :
rm -f $(AN)-code.zip
cd .. && zip "$(CWD)/$(AN)-code.zip" -r "$(CWD)"
@echo Zip created in $(AN)-code.zip
@if (( $$(stat -c '%s' $(AN)-code.zip) > 10*(2**20) ));
then echo "WARNING: $(AN)-code.zip seems REALLY big,
check there are no abnormally large test files"; du -h $(AN)-
code.zip; fi
clean :
rm -f $(PROGRAMS) *.o
# int delta problem
deltas_main.o : deltas_main.c deltas.h
$(CC) -c $<
deltas_main : deltas_main.o read_deltas.o
$(CC) -o [email protected] $^
read_deltas.o : read_deltas.c deltas.h
$(CC) -c $<
save_deltas.o : save_deltas.c deltas.h
$(CC) -c $<
save_deltas : save_deltas.o
$(CC) -o [email protected] $^
# print_graph
print_graph.o : print_graph.c
$(CC) -c $<
print_graph_demo.o : print_graph_demo.c
$(CC) -c $<
print_graph_demo : print_graph_demo.o print_graph.o
$(CC) -o [email protected] $^
graph_file.o : graph_file.c
$(CC) -c $<
graph_file : graph_file.o print_graph.o read_deltas.o
$(CC) -o [email protected] $^
# hash problem
hash_main : hash_main.o hash_funcs.o
$(CC) -o [email protected] $^
hash_main.o : hash_main.c hashmap.h
$(CC) -c $<
hash_funcs.o : hash_funcs.c hashmap.h
$(CC) -c $<
# Testing Targets
VALGRIND = valgrind --leak-check=full --show-leak-kinds=all
test : test-p1 test-p2 test-p3
test-p1 : test-p1-norm test-p1-valg
test-p1-norm : test_read_deltas
@printf "===P1 Normal tests for read_deltas() via
test_read_deltas===n"
./test_read_deltas
@printf "n"
test-p1-valg : test_read_deltas
@printf "n"
@printf "===P1 Valgrind tests for read_deltas() via
test_read_deltas===n"
@echo $(VALGRIND) ./test_read_deltas
@$(VALGRIND) ./test_read_deltas >& test-data/p1-
valgrind.tmp
@chmod u+rx ./test_check_valgrind.sh
@./test_check_valgrind.sh 5 'PROBLEM 1 Valgrind
Memory Checks' test-data/p1-valgrind.tmp
@printf "n"
test_read_deltas.o : test_read_deltas.c deltas.h
$(CC) -c $<
test_read_deltas : test_read_deltas.o read_deltas.o
$(CC) -o [email protected] $^
test-p2 : test-p2a test-p2b
test-p2a : print_graph_demo graph_file save_deltas
@printf "===TESTS for P2A===n"
@printf "Testing print_graph() via print_graph_demon"
@chmod u+rx ./test_print_graph.sh
./test_print_graph.sh
test-p2b : print_graph_demo graph_file save_deltas
@printf "===TESTS for P2B===n"
@printf "Testing graph_filen"
@chmod u+rx ./test_graph_file.sh
./test_graph_file.sh
test-p3 : hash_main
@printf "===TESTS for P3===n"
@chmod u+rx ./test_hash_main.sh
./test_hash_main.sh
clean-tests :
rm -f test_read_deltas
rm -f test-data/*.tmp test-data/*.tree
__MACOSX/a1-code/._Makefile
a1-code/test_print_graph.sh
#!/bin/bash
#
# tests for print_graph_demo, run as one of
# > ./test_print_graph.sh # run everything
# > ./test_print_graph.sh 2 # run only tests 2
# > ./test_print_graph.sh norm # run only normal tests
# > ./test_print_graph.sh valg # run only valgrind tests
# > ./test_print_graph.sh norm 2 # run only normal test 2
# > ./test_print_graph.sh valg 2 # run only vaglgrind test 2
#
# 4 point(s) for the single normal test
# 1 point(s) for avoiding memory problems under Valgrind
function major_sep(){
printf '%sn'
'====================================='
}
function minor_sep(){
printf '%sn' '-------------------------------------'
}
# major_sep
# printf "PROBLEM 2A print_graph_demo.cn"
generate=1
run_norm=1 # run normal tests
run_valg=1 # run valgrind tests
norm_mult=4 # weighting for normal tests
valg_mult=1 # weighting for valgrind tests
VALGRIND="valgrind --leak-check=full --show-leak-
kinds=all"
DIFF="diff -bBy" # -b ignore whitespace, -B
ignore blank lines, -y do side-by-side comparison
INPUT=test-data/input.tmp # name for expected
output file
EXPECT=test-data/expect.tmp # name for expected
output file
ACTUAL=test-data/actual.tmp # name for actual
output file
DIFFOUT=test-data/diff.tmp # name for diff output
file
VALGOUT=test-data/valgrind.tmp # name for valgrind
output file
printf "Loading tests... "
source test_print_graph_data.sh
printf "%d tests loadedn" "$T"
NTESTS=$T
VTESTS=$T
NPASS=0
NVALG=0
all_tests=$(seq $NTESTS)
case "$1" in
norm)
run_valg=0
shift
;;
valg)
run_norm=0
shift
;;
esac
# Check whether a single test is being run
single_test=$1
if ((single_test > 0 && single_test <= NTESTS)); then
printf "Running single TEST %dn" "$single_test"
all_tests=$single_test
NTESTS=1
VTESTS=1
else
printf "Running %d testsn" "$NTESTS"
fi
printf "tests: %sn" "$all_tests"
printf "n"
# Run normal tests: capture output and check against expected
if [ "$run_norm" = "1" ]; then
minor_sep
printf "print_graph_demo NORMAL TESTSn"
for i in $all_tests; do
printf "TEST %2d %-18s : " "$i" "${tnames[i]}"
# run program on input file
{ ./print_graph_demo ; } >& $ACTUAL
# generate expected output
printf "%sn" "${output[i]}" > $EXPECT
# Check for failure, print side-by-side diff if problems
if ! $DIFF $EXPECT $ACTUAL > $DIFFOUT
then
printf "FAIL: Output Incorrectn"
minor_sep
printf "INPUT:n%sn" "${input[i]}"
printf "OUTPUT: EXPECT vs ACTUALn"
cat $DIFFOUT
if [ "$generate" == "1" ]; then
printf "FULL ACTUALn"
cat $ACTUAL
fi
minor_sep
else
printf "OKn"
((NPASS++))
fi
done
printf "Finishedn"
major_sep
printf "%2d / %2d Normal correctn"
"$((NPASS*norm_mult))" "$((NTESTS*norm_mult))"
printf "n"
fi
#
===============================================
=================================
# Run valgrind tests: check only for problems identified by
valgrind
if [ "$run_valg" = "1" ]; then
minor_sep
printf "print_graph_demo VALGRIND TESTSn"
for i in $all_tests; do
printf "TEST %2d %-18s : " "$i" "${tnames[i]}"
# Run the test
# generate the input file
printf "%sn" "${input[i]}" | ./save_deltas "${format[i]}"
$INPUT > /dev/null
# run code through valgrind
{ $VALGRIND ./print_graph_demo ; } >& $VALGOUT
# Check various outputs from valgrind
if ! grep -q 'ERROR SUMMARY: 0 errors from 0 contexts
(suppressed: 0 from 0)' $VALGOUT ||
! grep -q 'in use at exit: 0 bytes in 0 blocks'
$VALGOUT ||
grep -q 'definitely lost: 0 bytes in 0 blocks'
$VALGOUT;
then
printf "FAIL: Valgrind detected problemsn"
minor_sep
cat $VALGOUT
minor_sep
else
printf "Valgrind OKn"
((NVALG++))
fi
done
printf "Finishedn"
major_sep
printf "%2d / %2d Valgrind correctn"
"$((NVALG*valg_mult))" "$((VTESTS*valg_mult))"
printf "n"
fi
NPASS=$((NPASS*norm_mult))
NTESTS=$((NTESTS*norm_mult))
NVALG=$((NVALG*valg_mult))
VTESTS=$((VTESTS*valg_mult))
major_sep
printf "OVERALL:n"
printf "%2d / %2d Normal correctn" "$NPASS" "$NTESTS"
printf "%2d / %2d Valgrind correctn" "$NVALG" "$VTESTS"
printf "RESULTS: %d / %d points for normal/valgrind testsn"
"$((NPASS+NVALG))" "$((NTESTS+VTESTS))"
__MACOSX/a1-code/._test_print_graph.sh
a1-code/hashmap.h
// hashmap.h: header for hashmap problem
#ifndef HASHMAP_H
#define HASHMAP_H 1
// Type for linked list nodes in hash map
typedef struct hashnode {
char key[128]; // string key for items in the map
char val[128]; // string value for items in the map
struct hashnode *next; // pointer to next node, NULL if
last node
} hashnode_t;
// Type of hash table
typedef struct {
int item_count; // how many key/val pairs in the table
int table_size; // how big is the table array
hashnode_t **table; // array of pointers to nodes which
contain key/val pairs
} hashmap_t;
#define HASHMAP_DEFAULT_TABLE_SIZE 5 // default size
of table for main application
// functions defined in hash_funcs.c
long hashcode(char key[]);
int next_prime(int num);
void hashmap_init(hashmap_t *hm, int table_size);
int hashmap_put(hashmap_t *hm, char key[], char value[]);
void hashmap_expand(hashmap_t *hm);
char *hashmap_get(hashmap_t *hm, char key[]);
void hashmap_free_table(hashmap_t *hm);
void hashmap_write_items(hashmap_t *hm, FILE *out);
void hashmap_show_structure(hashmap_t *hm);
void hashmap_save(hashmap_t *hm, char *filename);
int hashmap_load(hashmap_t *hm, char *filename);
#endif
__MACOSX/a1-code/._hashmap.h
a1-code/deltas_main.o
a1-code/save_deltas
a1-code/print_graph.c
void print_graph(int *data, int len, int max_height){
int i,j,min_element,max_element,range;
double units_per_height, val;
min_element = data[0];
max_element = data[0];
for(i = 1; i < len; i++){
if(min_element > data[i])
min_element = data[i];
if(max_element < data[i])
max_element = data[i];
}
range = max_element - min_element;
units_per_height = (double)range / max_height;
printf("length: %dn", len);
printf("min: %dn", min_element);
printf("max: %dn", max_element);
printf("range: %dn", range);
printf("max_height: %dn", max_height);
printf("units_per_height: %.2lfn", units_per_height);
printf("nn%6c");
for(i = 0; i < len; i++){
if(i%5 == 0)
printf("+");
else
printf("-");
}
printf("n");
for(val = max_element; val >= 0; val -= units_per_height){
printf("%4d |" , (int)val);
for(j = 0; j < len; j++){
if(data[j] >= val)
printf("X");
else
printf(" ");
}
printf("n");
}
printf("%6c");
for(i = 0; i < len; i++){
if(i%5 == 0)
printf("+");
else
printf("-");
}
printf("n%6c");
for(i = 0; i < len; i+=5){
printf("%-5d", i);
}
printf("n");
}
__MACOSX/a1-code/._print_graph.c
a1-code/test_hash_main_data.sh
#!/bin/bash
T=0 # global test number
((T++))
tnames[T]="start-print-quit"
read -r -d '' input[$T] <<"ENDIN"
print
quit
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> print
HM> quit
ENDOUT
((T++))
tnames[T]="hashcode-get-empty"
read -r -d '' input[$T] <<"ENDIN"
print
hashcode a
hashcode A
hashcode Aa
hashcode apple
hashcode banana
get a
get Aa
get apple
get banana
quit
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> print
HM> hashcode a
97
HM> hashcode A
65
HM> hashcode Aa
24897
HM> hashcode apple
1819308129
HM> hashcode banana
1634623842
HM> get a
NOT FOUND
HM> get Aa
NOT FOUND
HM> get apple
NOT FOUND
HM> get banana
NOT FOUND
HM> quit
ENDOUT
((T++))
tnames[T]="get-single"
read -r -d '' input[$T] <<"ENDIN"
print
put apple fruit
get apple
get banana
quit
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> print
HM> put apple fruit
HM> get apple
FOUND: fruit
HM> get banana
NOT FOUND
HM> quit
ENDOUT
((T++))
tnames[T]="put3"
read -r -d '' input[$T] <<"ENDIN"
put Kyle alive
put Kenny dead
put Stan alive
print
get Kyle
get Kenny
get Stan
get Cartman
get Token
quit
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> put Kyle alive
HM> put Kenny dead
HM> put Stan alive
HM> print
Kyle : alive
Stan : alive
Kenny : dead
HM> get Kyle
FOUND: alive
HM> get Kenny
FOUND: dead
HM> get Stan
FOUND: alive
HM> get Cartman
NOT FOUND
HM> get Token
NOT FOUND
HM> quit
ENDOUT
((T++))
tnames[T]="put-collisions"
read -r -d '' input[$T] <<"ENDIN"
put B 1
put D 2
put N 3
print
get B
get D
get N
get C
get I
put A 4
put C 5
put I 6
put X 7
put W 8
print
get A
get B
get C
get D
get E
get I
get X
get W
get Z
quit
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> put B 1
HM> put D 2
HM> put N 3
HM> print
B : 1
D : 2
N : 3
HM> get B
FOUND: 1
HM> get D
FOUND: 2
HM> get N
FOUND: 3
HM> get C
NOT FOUND
HM> get I
NOT FOUND
HM> put A 4
HM> put C 5
HM> put I 6
HM> put X 7
HM> put W 8
HM> print
A : 4
B : 1
C : 5
W : 8
D : 2
N : 3
I : 6
X : 7
HM> get A
FOUND: 4
HM> get B
FOUND: 1
HM> get C
FOUND: 5
HM> get D
FOUND: 2
HM> get E
NOT FOUND
HM> get I
FOUND: 6
HM> get X
FOUND: 7
HM> get W
FOUND: 8
HM> get Z
NOT FOUND
HM> quit
ENDOUT
((T++))
tnames[T]="put3-structure"
read -r -d '' input[$T] <<"ENDIN"
put B 1
put D 2
put N 3
print
get B
get D
get N
get C
get I
structure
quit
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> put B 1
HM> put D 2
HM> put N 3
HM> print
B : 1
D : 2
N : 3
HM> get B
FOUND: 1
HM> get D
FOUND: 2
HM> get N
FOUND: 3
HM> get C
NOT FOUND
HM> get I
NOT FOUND
HM> structure
item_count: 3
table_size: 5
load_factor: 0.6000
0 :
1 : {(66) B : 1}
2 :
3 : {(68) D : 2} {(78) N : 3}
4 :
HM> quit
ENDOUT
((T++))
tnames[T]="put-overwrite"
read -r -d '' input[$T] <<"ENDIN"
put B 1
put D 2
put N 3
put A 4
put C 5
put I 6
put X 7
put W 8
structure
put B 11
put I 66
put A 44
put W 88
structure
get B
get D
get I
get W
get X
quit
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> put B 1
HM> put D 2
HM> put N 3
HM> put A 4
HM> put C 5
HM> put I 6
HM> put X 7
HM> put W 8
HM> structure
item_count: 8
table_size: 5
load_factor: 1.6000
0 : {(65) A : 4}
1 : {(66) B : 1}
2 : {(67) C : 5} {(87) W : 8}
3 : {(68) D : 2} {(78) N : 3} {(73) I : 6} {(88) X : 7}
4 :
HM> put B 11
Overwriting previous key/val
HM> put I 66
Overwriting previous key/val
HM> put A 44
Overwriting previous key/val
HM> put W 88
Overwriting previous key/val
HM> structure
item_count: 8
table_size: 5
load_factor: 1.6000
0 : {(65) A : 44}
1 : {(66) B : 11}
2 : {(67) C : 5} {(87) W : 88}
3 : {(68) D : 2} {(78) N : 3} {(73) I : 66} {(88) X : 7}
4 :
HM> get B
FOUND: 11
HM> get D
FOUND: 2
HM> get I
FOUND: 66
HM> get W
FOUND: 88
HM> get X
FOUND: 7
HM> quit
ENDOUT
((T++))
tnames[T]="larger-structure"
read -r -d '' input[$T] <<"ENDIN"
put Kyle alive
put Kenny dead
put Stan alive
print
structure
put Cartman jerk
put Timmy TIMMY!
put MrGarrison odd
put MrHat very-odd
put Butters lovable
put Chef disavowed
print
structure
quit
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> put Kyle alive
HM> put Kenny dead
HM> put Stan alive
HM> print
Kyle : alive
Stan : alive
Kenny : dead
HM> structure
item_count: 3
table_size: 5
load_factor: 0.6000
0 : {(1701607755) Kyle : alive}
1 : {(1851880531) Stan : alive}
2 : {(521543771467) Kenny : dead}
3 :
4 :
HM> put Cartman jerk
HM> put Timmy TIMMY!
HM> put MrGarrison odd
HM> put MrHat very-odd
HM> put Butters lovable
HM> put Chef disavowed
HM> print
Kyle : alive
Cartman : jerk
Butters : lovable
Stan : alive
MrHat : very-odd
Kenny : dead
MrGarrison : odd
Timmy : TIMMY!
Chef : disavowed
HM> structure
item_count: 9
table_size: 5
load_factor: 1.8000
0 : {(1701607755) Kyle : alive} {(31069370171154755)
Cartman : jerk} {(32495402392778050) Butters : lovable}
1 : {(1851880531) Stan : alive} {(499848344141) MrHat :
very-odd}
2 : {(521543771467) Kenny : dead} {(8316304022500241997)
MrGarrison : odd}
3 : {(521526929748) Timmy : TIMMY!}
4 : {(1717921859) Chef : disavowed}
HM> quit
ENDOUT
((T++))
tnames[T]="put3-EOF"
read -r -d '' input[$T] <<"ENDIN"
put Kyle alive
put Kenny dead
put Stan alive
print
get Kyle
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> put Kyle alive
HM> put Kenny dead
HM> put Stan alive
HM> print
Kyle : alive
Stan : alive
Kenny : dead
HM> get Kyle
FOUND: alive
HM>
ENDOUT
((T++))
tnames[T]="clear-put-clear"
read -r -d '' input[$T] <<"ENDIN"
clear
print
structure
put Kyle alive
put Kenny dead
put Stan alive
put Cartman jerk
print
structure
clear
print
structure
put Timmy TIMMY!
put MrGarrison odd
put MrHat very-odd
put Butters lovable
put Chef disavowed
print
structure
clear
print
structure
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> clear
HM> print
HM> structure
item_count: 0
table_size: 5
load_factor: 0.0000
0 :
1 :
2 :
3 :
4 :
HM> put Kyle alive
HM> put Kenny dead
HM> put Stan alive
HM> put Cartman jerk
HM> print
Kyle : alive
Cartman : jerk
Stan : alive
Kenny : dead
HM> structure
item_count: 4
table_size: 5
load_factor: 0.8000
0 : {(1701607755) Kyle : alive} {(31069370171154755)
Cartman : jerk}
1 : {(1851880531) Stan : alive}
2 : {(521543771467) Kenny : dead}
3 :
4 :
HM> clear
HM> print
HM> structure
item_count: 0
table_size: 5
load_factor: 0.0000
0 :
1 :
2 :
3 :
4 :
HM> put Timmy TIMMY!
HM> put MrGarrison odd
HM> put MrHat very-odd
HM> put Butters lovable
HM> put Chef disavowed
HM> print
Butters : lovable
MrHat : very-odd
MrGarrison : odd
Timmy : TIMMY!
Chef : disavowed
HM> structure
item_count: 5
table_size: 5
load_factor: 1.0000
0 : {(32495402392778050) Butters : lovable}
1 : {(499848344141) MrHat : very-odd}
2 : {(8316304022500241997) MrGarrison : odd}
3 : {(521526929748) Timmy : TIMMY!}
4 : {(1717921859) Chef : disavowed}
HM> clear
HM> print
HM> structure
item_count: 0
table_size: 5
load_factor: 0.0000
0 :
1 :
2 :
3 :
4 :
HM>
ENDOUT
((T++))
tnames[T]="put3-save"
read -r -d '' input[$T] <<"ENDIN"
put A 1
put E 2
put C 3
put D 4
save test-data/put3.tmp
quit
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> put A 1
HM> put E 2
HM> put C 3
HM> put D 4
HM> save test-data/put3.tmp
HM> quit
ENDOUT
#
tfiles[T]="test-data/put3.tmp"
read -r -d '' tfiles_expect[$T] <<"ENDOUT"
5 4
A : 1
C : 3
D : 4
E : 2
ENDOUT
((T++))
tnames[T]="put-many-save"
read -r -d '' input[$T] <<"ENDIN"
put Kyle alive
put Kenny dead
put Stan alive
put Cartman jerk
put Timmy TIMMY!
put MrGarrison odd
put MrHat very-odd
put Butters lovable
put Chef disavowed
print
structure
save test-data/put-many.tmp
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> put Kyle alive
HM> put Kenny dead
HM> put Stan alive
HM> put Cartman jerk
HM> put Timmy TIMMY!
HM> put MrGarrison odd
HM> put MrHat very-odd
HM> put Butters lovable
HM> put Chef disavowed
HM> print
Kyle : alive
Cartman : jerk
Butters : lovable
Stan : alive
MrHat : very-odd
Kenny : dead
MrGarrison : odd
Timmy : TIMMY!
Chef : disavowed
HM> structure
item_count: 9
table_size: 5
load_factor: 1.8000
0 : {(1701607755) Kyle : alive} {(31069370171154755)
Cartman : jerk} {(32495402392778050) Butters : lovable}
1 : {(1851880531) Stan : alive} {(499848344141) MrHat :
very-odd}
2 : {(521543771467) Kenny : dead} {(8316304022500241997)
MrGarrison : odd}
3 : {(521526929748) Timmy : TIMMY!}
4 : {(1717921859) Chef : disavowed}
HM> save test-data/put-many.tmp
HM>
ENDOUT
#
tfiles[T]="test-data/put-many.tmp"
read -r -d '' tfiles_expect[$T] <<"ENDOUT"
5 9
Kyle : alive
Cartman : jerk
Butters : lovable
Stan : alive
MrHat : very-odd
Kenny : dead
MrGarrison : odd
Timmy : TIMMY!
Chef : disavowed
ENDOUT
((T++))
tnames[T]="save-load"
read -r -d '' input[$T] <<"ENDIN"
put A 1
put E 2
put C 3
put D 4
save test-data/save-load.tmp
clear
print
load test-data/save-load.tmp
print
structure
get E
get R
get A
put R 5
put S 6
print structure
get R
get S
load test-data/save-load.tmp
print
structure
get R
get S
load test-data/not-there.tmp
print
quit
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> put A 1
HM> put E 2
HM> put C 3
HM> put D 4
HM> save test-data/save-load.tmp
HM> clear
HM> print
HM> load test-data/save-load.tmp
HM> print
A : 1
C : 3
D : 4
E : 2
HM> structure
item_count: 4
table_size: 5
load_factor: 0.8000
0 : {(65) A : 1}
1 :
2 : {(67) C : 3}
3 : {(68) D : 4}
4 : {(69) E : 2}
HM> get E
FOUND: 2
HM> get R
NOT FOUND
HM> get A
FOUND: 1
HM> put R 5
HM> put S 6
HM> print
A : 1
C : 3
R : 5
D : 4
S : 6
E : 2
HM> structure
item_count: 6
table_size: 5
load_factor: 1.2000
0 : {(65) A : 1}
1 :
2 : {(67) C : 3} {(82) R : 5}
3 : {(68) D : 4} {(83) S : 6}
4 : {(69) E : 2}
HM> get R
FOUND: 5
HM> get S
FOUND: 6
HM> load test-data/save-load.tmp
HM> print
A : 1
C : 3
D : 4
E : 2
HM> structure
item_count: 4
table_size: 5
load_factor: 0.8000
0 : {(65) A : 1}
1 :
2 : {(67) C : 3}
3 : {(68) D : 4}
4 : {(69) E : 2}
HM> get R
NOT FOUND
HM> get S
NOT FOUND
HM> load test-data/not-there.tmp
ERROR: could not open file 'test-data/not-there.tmp'
load failed
HM> print
A : 1
C : 3
D : 4
E : 2
HM> quit
ENDOUT
#
tfiles[T]="test-data/save-load.tmp"
read -r -d '' tfiles_expect[$T] <<"ENDOUT"
5 4
A : 1
C : 3
D : 4
E : 2
ENDOUT
((T++))
tnames[T]="prime-expand"
read -r -d '' input[$T] <<"ENDIN"
next_prime 5
next_prime 6
next_prime 10
next_prime 25
next_prime 1024
put A 1
put B 2
put C 3
put D 4
put E 5
put F 6
put G 7
print
structure
expand
print
structure
expand
print
structure
clear
put Kyle alive
put Kenny dead
put Stan alive
put Cartman jerk
put Timmy TIMMY!
put MrGarrison odd
put MrHat very-odd
put Butters lovable
put Chef disavowed
print
structure
expand
print
structure
put Token dude
put Wendy gal
put Jimmy crutches
put Damien evil
put Santa bad
put Jesus good
put Marvin starvin
print
structure
expand
print
structure
expand
print
structure
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> next_prime 5
5
HM> next_prime 6
7
HM> next_prime 10
11
HM> next_prime 25
29
HM> next_prime 1024
1031
HM> put A 1
HM> put B 2
HM> put C 3
HM> put D 4
HM> put E 5
HM> put F 6
HM> put G 7
HM> print
A : 1
F : 6
B : 2
G : 7
C : 3
D : 4
E : 5
HM> structure
item_count: 7
table_size: 5
load_factor: 1.4000
0 : {(65) A : 1} {(70) F : 6}
1 : {(66) B : 2} {(71) G : 7}
2 : {(67) C : 3}
3 : {(68) D : 4}
4 : {(69) E : 5}
HM> expand
HM> print
B : 2
C : 3
D : 4
E : 5
F : 6
G : 7
A : 1
HM> structure
item_count: 7
table_size: 11
load_factor: 0.6364
0 : {(66) B : 2}
1 : {(67) C : 3}
2 : {(68) D : 4}
3 : {(69) E : 5}
4 : {(70) F : 6}
5 : {(71) G : 7}
6 :
7 :
8 :
9 :
10 : {(65) A : 1}
HM> expand
HM> print
E : 5
F : 6
G : 7
A : 1
B : 2
C : 3
D : 4
HM> structure
item_count: 7
table_size: 23
load_factor: 0.3043
0 : {(69) E : 5}
1 : {(70) F : 6}
2 : {(71) G : 7}
3 :
4 :
5 :
6 :
7 :
8 :
9 :
10 :
11 :
12 :
13 :
14 :
15 :
16 :
17 :
18 :
19 : {(65) A : 1}
20 : {(66) B : 2}
21 : {(67) C : 3}
22 : {(68) D : 4}
HM> clear
HM> put Kyle alive
HM> put Kenny dead
HM> put Stan alive
HM> put Cartman jerk
HM> put Timmy TIMMY!
HM> put MrGarrison odd
HM> put MrHat very-odd
HM> put Butters lovable
HM> put Chef disavowed
HM> print
Kyle : alive
Cartman : jerk
Butters : lovable
Stan : alive
MrHat : very-odd
Kenny : dead
MrGarrison : odd
Timmy : TIMMY!
Chef : disavowed
HM> structure
item_count: 9
table_size: 5
load_factor: 1.8000
0 : {(1701607755) Kyle : alive} {(31069370171154755)
Cartman : jerk} {(32495402392778050) Butters : lovable}
1 : {(1851880531) Stan : alive} {(499848344141) MrHat :
very-odd}
2 : {(521543771467) Kenny : dead} {(8316304022500241997)
MrGarrison : odd}
3 : {(521526929748) Timmy : TIMMY!}
4 : {(1717921859) Chef : disavowed}
HM> expand
HM> print
Cartman : jerk
Butters : lovable
Timmy : TIMMY!
Kyle : alive
MrHat : very-odd
Kenny : dead
Chef : disavowed
Stan : alive
MrGarrison : odd
HM> structure
item_count: 9
table_size: 11
load_factor: 0.8182
0 : {(31069370171154755) Cartman : jerk}
{(32495402392778050) Butters : lovable} {(521526929748)
Timmy : TIMMY!}
1 : {(1701607755) Kyle : alive}
2 :
3 : {(499848344141) MrHat : very-odd}
4 : {(521543771467) Kenny : dead}
5 : {(1717921859) Chef : disavowed}
6 : {(1851880531) Stan : alive}
7 :
8 :
9 : {(8316304022500241997) MrGarrison : odd}
10 :
HM> put Token dude
HM> put Wendy gal
HM> put Jimmy crutches
HM> put Damien evil
HM> put Santa bad
HM> put Jesus good
HM> put Marvin starvin
HM> print
Cartman : jerk
Butters : lovable
Timmy : TIMMY!
Santa : bad
Kyle : alive
Jimmy : crutches
MrHat : very-odd
Damien : evil
Kenny : dead
Token : dude
Jesus : good
Chef : disavowed
Stan : alive
Marvin : starvin
MrGarrison : odd
Wendy : gal
HM> structure
item_count: 16
table_size: 11
load_factor: 1.4545
0 : {(31069370171154755) Cartman : jerk}
{(32495402392778050) Butters : lovable} {(521526929748)
Timmy : TIMMY!} {(418565218643) Santa : bad}
1 : {(1701607755) Kyle : alive} {(521526929738) Jimmy :
crutches}
2 :
3 : {(499848344141) MrHat : very-odd} {(121381839528260)
Damien : evil}
4 : {(521543771467) Kenny : dead} {(474147942228) Token :
dude} {(495891735882) Jesus : good}
5 : {(1717921859) Chef : disavowed}
6 : {(1851880531) Stan : alive} {(121399237828941) Marvin :
starvin}
7 :
8 :
9 : {(8316304022500241997) MrGarrison : odd}
10 : {(521375999319) Wendy : gal}
HM> expand
HM> print
Timmy : TIMMY!
Santa : bad
Marvin : starvin
Damien : evil
Wendy : gal
Cartman : jerk
Jimmy : crutches
Kenny : dead
Jesus : good
Chef : disavowed
MrHat : very-odd
Butters : lovable
Stan : alive
MrGarrison : odd
Kyle : alive
Token : dude
HM> structure
item_count: 16
table_size: 23
load_factor: 0.6957
0 :
1 :
2 : {(521526929748) Timmy : TIMMY!} {(418565218643)
Santa : bad} {(121399237828941) Marvin : starvin}
3 :
4 :
5 :
6 :
7 :
8 :
9 : {(121381839528260) Damien : evil}
10 :
11 :
12 : {(521375999319) Wendy : gal}
13 : {(31069370171154755) Cartman : jerk}
14 :
15 : {(521526929738) Jimmy : crutches}
16 :
17 : {(521543771467) Kenny : dead} {(495891735882) Jesus :
good} {(1717921859) Chef : disavowed}
18 : {(499848344141) MrHat : very-odd}
19 : {(32495402392778050) Butters : lovable} {(1851880531)
Stan : alive} {(8316304022500241997) MrGarrison : odd}
20 : {(1701607755) Kyle : alive}
21 :
22 : {(474147942228) Token : dude}
HM> expand
HM> print
Jimmy : crutches
Timmy : TIMMY!
Kyle : alive
Butters : lovable
Cartman : jerk
Stan : alive
Wendy : gal
Jesus : good
Damien : evil
MrGarrison : odd
Kenny : dead
Marvin : starvin
Santa : bad
Chef : disavowed
MrHat : very-odd
Token : dude
HM> structure
item_count: 16
table_size: 47
load_factor: 0.3404
0 : {(521526929738) Jimmy : crutches}
1 :
2 :
3 :
4 :
5 :
6 :
7 :
8 :
9 :
10 : {(521526929748) Timmy : TIMMY!}
11 :
12 :
13 :
14 :
15 : {(1701607755) Kyle : alive}
16 :
17 :
18 :
19 : {(32495402392778050) Butters : lovable}
20 : {(31069370171154755) Cartman : jerk} {(1851880531)
Stan : alive}
21 :
22 :
23 : {(521375999319) Wendy : gal} {(495891735882) Jesus :
good}
24 : {(121381839528260) Damien : evil}
25 :
26 : {(8316304022500241997) MrGarrison : odd}
27 :
28 :
29 :
30 :
31 : {(521543771467) Kenny : dead}
32 :
33 :
34 :
35 : {(121399237828941) Marvin : starvin}
36 :
37 :
38 :
39 :
40 : {(418565218643) Santa : bad}
41 :
42 :
43 : {(1717921859) Chef : disavowed}
44 : {(499848344141) MrHat : very-odd}
45 : {(474147942228) Token : dude}
46 :
HM>
ENDOUT
((T++))
tnames[T]="stress"
read -r -d '' input[$T] <<"ENDIN"
put Kyle alive
put Kenny dead
put Stan alive
put Cartman jerk
put Timmy TIMMY!
put MrGarrison odd
put MrHat very-odd
put Butters lovable
put Chef disavowed
structure
expand
structure
save test-data/stress1.tmp
put Token dude
put Wendy gal
put Jimmy crutches
put Damien evil
put Santa bad
put Jesus good
put Marvin starvin
put Kenny ALIVE
put MrHat MrStick
structure
expand
expand
structure
save test-data/stress2.tmp
load test-data/stress1.tmp
structure
get Santa
get Marvin
get Cartman
get MrHat
put Syndney Portier
put Robert Smith
expand
expand
expand
structure
get Cartman
get Robert
save test-data/stress3.tmp
load test-data/stress2.tmp
print
structure
get MrGarrison
get MrHat
get Kenny
get Santa
get Wendy
get Marvin
get Sydney
put Kenny dead
load test-data/stress3.tmp
get Kenny
structure
expand
structure
quit
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Hashmap Demo
Commands:
hashcode <key> : prints out the numeric hash code for the
given key (does not change the hash map)
put <key> <val> : inserts the given key/val into the hash map,
overwrites existing values if present
get <key> : prints the value associated with the given key
or NOT FOUND
print : shows contents of the hashmap ordered by how
they appear in the table
structure : prints detailed structure of the hash map
clear : reinitializes hash map to be empty with default
size
save <file> : writes the contents of the hash map the given
file
load <file> : clears the current hash map and loads the one
in the given file
next_prime <int> : if <int> is prime, prints it, otherwise finds
the next prime and prints it
expand : expands memory size of hashmap to reduce its
load factor
quit : exit the program
HM> put Kyle alive
HM> put Kenny dead
HM> put Stan alive
HM> put Cartman jerk
HM> put Timmy TIMMY!
HM> put MrGarrison odd
HM> put MrHat very-odd
HM> put Butters lovable
HM> put Chef disavowed
HM> structure
item_count: 9
table_size: 5
load_factor: 1.8000
0 : {(1701607755) Kyle : alive} {(31069370171154755)
Cartman : jerk} {(32495402392778050) Butters : lovable}
1 : {(1851880531) Stan : alive} {(499848344141) MrHat :
very-odd}
2 : {(521543771467) Kenny : dead} {(8316304022500241997)
MrGarrison : odd}
3 : {(521526929748) Timmy : TIMMY!}
4 : {(1717921859) Chef : disavowed}
HM> expand
HM> structure
item_count: 9
table_size: 11
load_factor: 0.8182
0 : {(31069370171154755) Cartman : jerk}
{(32495402392778050) Butters : lovable} {(521526929748)
Timmy : TIMMY!}
1 : {(1701607755) Kyle : alive}
2 :
3 : {(499848344141) MrHat : very-odd}
4 : {(521543771467) Kenny : dead}
5 : {(1717921859) Chef : disavowed}
6 : {(1851880531) Stan : alive}
7 :
8 :
9 : {(8316304022500241997) MrGarrison : odd}
10 :
HM> save test-data/stress1.tmp
HM> put Token dude
HM> put Wendy gal
HM> put Jimmy crutches
HM> put Damien evil
HM> put Santa bad
HM> put Jesus good
HM> put Marvin starvin
HM> put Kenny ALIVE
Overwriting previous key/val
HM> put MrHat MrStick
Overwriting previous key/val
HM> structure
item_count: 16
table_size: 11
load_factor: 1.4545
0 : {(31069370171154755) Cartman : jerk}
{(32495402392778050) Butters : lovable} {(521526929748)
Timmy : TIMMY!} {(418565218643) Santa : bad}
1 : {(1701607755) Kyle : alive} {(521526929738) Jimmy :
crutches}
2 :
3 : {(499848344141) MrHat : MrStick} {(121381839528260)
Damien : evil}
4 : {(521543771467) Kenny : ALIVE} {(474147942228)
Token : dude} {(495891735882) Jesus : good}
5 : {(1717921859) Chef : disavowed}
6 : {(1851880531) Stan : alive} {(121399237828941) Marvin :
starvin}
7 :
8 :
9 : {(8316304022500241997) MrGarrison : odd}
10 : {(521375999319) Wendy : gal}
HM> expand
HM> expand
HM> structure
item_count: 16
table_size: 47
load_factor: 0.3404
0 : {(521526929738) Jimmy : crutches}
1 :
2 :
3 :
4 :
5 :
6 :
7 :
8 :
9 :
10 : {(521526929748) Timmy : TIMMY!}
11 :
12 :
13 :
14 :
15 : {(1701607755) Kyle : alive}
16 :
17 :
18 :
19 : {(32495402392778050) Butters : lovable}
20 : {(31069370171154755) Cartman : jerk} {(1851880531)
Stan : alive}
21 :
22 :
23 : {(521375999319) Wendy : gal} {(495891735882) Jesus :
good}
24 : {(121381839528260) Damien : evil}
25 :
26 : {(8316304022500241997) MrGarrison : odd}
27 :
28 :
29 :
30 :
31 : {(521543771467) Kenny : ALIVE}
32 :
33 :
34 :
35 : {(121399237828941) Marvin : starvin}
36 :
37 :
38 :
39 :
40 : {(418565218643) Santa : bad}
41 :
42 :
43 : {(1717921859) Chef : disavowed}
44 : {(499848344141) MrHat : MrStick}
45 : {(474147942228) Token : dude}
46 :
HM> save test-data/stress2.tmp
HM> load test-data/stress1.tmp
HM> structure
item_count: 9
table_size: 11
load_factor: 0.8182
0 : {(31069370171154755) Cartman : jerk}
{(32495402392778050) Butters : lovable} {(521526929748)
Timmy : TIMMY!}
1 : {(1701607755) Kyle : alive}
2 :
3 : {(499848344141) MrHat : very-odd}
4 : {(521543771467) Kenny : dead}
5 : {(1717921859) Chef : disavowed}
6 : {(1851880531) Stan : alive}
7 :
8 :
9 : {(8316304022500241997) MrGarrison : odd}
10 :
HM> get Santa
NOT FOUND
HM> get Marvin
NOT FOUND
HM> get Cartman
FOUND: jerk
HM> get MrHat
FOUND: very-odd
HM> put Syndney Portier
HM> put Robert Smith
HM> expand
HM> expand
HM> expand
HM> structure
item_count: 11
table_size: 97
load_factor: 0.1134
0 :
1 :
2 :
3 : {(521543771467) Kenny : dead}
4 :
5 :
6 : {(521526929748) Timmy : TIMMY!}
7 :
8 :
9 :
10 :
11 :
12 :
13 :
14 :
15 : {(32495402392778050) Butters : lovable}
16 :
17 :
18 :
19 :
20 :
21 :
22 :
23 :
24 :
25 :
26 :
27 :
28 :
29 :
30 :
31 :
32 :
33 : {(8316304022500241997) MrGarrison : odd}
34 :
35 :
36 :
37 :
38 :
39 :
40 :
41 :
42 :
43 :
44 :
45 :
46 :
47 :
48 :
49 :
50 :
51 :
52 :
53 :
54 :
55 : {(128034676043602) Robert : Smith}
56 :
57 :
58 :
59 :
60 :
61 : {(1717921859) Chef : disavowed}
62 :
63 : {(31069370171154755) Cartman : jerk}
64 :
65 :
66 :
67 :
68 :
69 :
70 :
71 :
72 :
73 :
74 : {(34169996987758931) Syndney : Portier}
75 :
76 :
77 : {(499848344141) MrHat : very-odd}
78 :
79 :
80 :
81 :
82 :
83 :
84 : {(1851880531) Stan : alive}
85 :
86 :
87 :
88 :
89 :
90 :
91 :
92 :
93 :
94 :
95 :
96 : {(1701607755) Kyle : alive}
HM> get Cartman
FOUND: jerk
HM> get Robert
FOUND: Smith
HM> save test-data/stress3.tmp
HM> load test-data/stress2.tmp
HM> print
Jimmy : crutches
Timmy : TIMMY!
Kyle : alive
Butters : lovable
Cartman : jerk
Stan : alive
Wendy : gal
Jesus : good
Damien : evil
MrGarrison : odd
Kenny : ALIVE
Marvin : starvin
Santa : bad
Chef : disavowed
MrHat : MrStick
Token : dude
HM> structure
item_count: 16
table_size: 47
load_factor: 0.3404
0 : {(521526929738) Jimmy : crutches}
1 :
2 :
3 :
4 :
5 :
6 :
7 :
8 :
9 :
10 : {(521526929748) Timmy : TIMMY!}
11 :
12 :
13 :
14 :
15 : {(1701607755) Kyle : alive}
16 :
17 :
18 :
19 : {(32495402392778050) Butters : lovable}
20 : {(31069370171154755) Cartman : jerk} {(1851880531)
Stan : alive}
21 :
22 :
23 : {(521375999319) Wendy : gal} {(495891735882) Jesus :
good}
24 : {(121381839528260) Damien : evil}
25 :
26 : {(8316304022500241997) MrGarrison : odd}
27 :
28 :
29 :
30 :
31 : {(521543771467) Kenny : ALIVE}
32 :
33 :
34 :
35 : {(121399237828941) Marvin : starvin}
36 :
37 :
38 :
39 :
40 : {(418565218643) Santa : bad}
41 :
42 :
43 : {(1717921859) Chef : disavowed}
44 : {(499848344141) MrHat : MrStick}
45 : {(474147942228) Token : dude}
46 :
HM> get MrGarrison
FOUND: odd
HM> get MrHat
FOUND: MrStick
HM> get Kenny
FOUND: ALIVE
HM> get Santa
FOUND: bad
HM> get Wendy
FOUND: gal
HM> get Marvin
FOUND: starvin
HM> get Sydney
NOT FOUND
HM> put Kenny dead
Overwriting previous key/val
HM> load test-data/stress3.tmp
HM> get Kenny
FOUND: dead
HM> structure
item_count: 11
table_size: 97
load_factor: 0.1134
0 :
1 :
2 :
3 : {(521543771467) Kenny : dead}
4 :
5 :
6 : {(521526929748) Timmy : TIMMY!}
7 :
8 :
9 :
10 :
11 :
12 :
13 :
14 :
15 : {(32495402392778050) Butters : lovable}
16 :
17 :
18 :
19 :
20 :
21 :
22 :
23 :
24 :
25 :
26 :
27 :
28 :
29 :
30 :
31 :
32 :
33 : {(8316304022500241997) MrGarrison : odd}
34 :
35 :
36 :
37 :
38 :
39 :
40 :
41 :
42 :
43 :
44 :
45 :
46 :
47 :
48 :
49 :
50 :
51 :
52 :
53 :
54 :
55 : {(128034676043602) Robert : Smith}
56 :
57 :
58 :
59 :
60 :
61 : {(1717921859) Chef : disavowed}
62 :
63 : {(31069370171154755) Cartman : jerk}
64 :
65 :
66 :
67 :
68 :
69 :
70 :
71 :
72 :
73 :
74 : {(34169996987758931) Syndney : Portier}
75 :
76 :
77 : {(499848344141) MrHat : very-odd}
78 :
79 :
80 :
81 :
82 :
83 :
84 : {(1851880531) Stan : alive}
85 :
86 :
87 :
88 :
89 :
90 :
91 :
92 :
93 :
94 :
95 :
96 : {(1701607755) Kyle : alive}
HM> expand
HM> structure
item_count: 11
table_size: 197
load_factor: 0.0558
0 :
1 :
2 :
3 : {(521543771467) Kenny : dead}
4 :
5 :
6 :
7 :
8 :
9 :
10 :
11 : {(521526929748) Timmy : TIMMY!}
12 :
13 :
14 :
15 :
16 :
17 :
18 :
19 :
20 :
21 :
22 :
23 :
24 :
25 :
26 :
27 :
28 :
29 :
30 :
31 :
32 :
33 :
34 :
35 :
36 :
37 :
38 :
39 :
40 :
41 :
42 :
43 :
44 :
45 :
46 :
47 :
48 :
49 :
50 :
51 :
52 :
53 :
54 :
55 :
56 :
57 :
58 : {(499848344141) MrHat : very-odd}
59 : {(128034676043602) Robert : Smith}
60 :
61 :
62 :
63 :
64 :
65 :
66 :
67 :
68 :
69 :
70 :
71 :
72 :
73 :
74 :
75 :
76 :
77 : {(34169996987758931) Syndney : Portier}
78 :
79 :
80 :
81 :
82 : {(8316304022500241997) MrGarrison : odd}
83 :
84 :
85 :
86 :
87 :
88 :
89 :
90 :
91 :
92 : {(32495402392778050) Butters : lovable}
93 :
94 :
95 :
96 :
97 :
98 :
99 :
100 :
101 :
102 :
103 :
104 : {(1717921859) Chef : disavowed}
105 :
106 :
107 :
108 :
109 :
110 :
111 :
112 :
113 :
114 :
115 :
116 :
117 :
118 :
119 :
120 :
121 :
122 :
123 :
124 :
125 :
126 :
127 :
128 :
129 :
130 :
131 :
132 :
133 :
134 :
135 :
136 :
137 :
138 :
139 :
140 :
141 :
142 :
143 :
144 :
145 :
146 :
147 :
148 :
149 :
150 :
151 :
152 :
153 :
154 :
155 : {(1851880531) Stan : alive}
156 :
157 :
158 :
159 :
160 :
161 : {(1701607755) Kyle : alive}
162 :
163 :
164 :
165 :
166 :
167 :
168 : {(31069370171154755) Cartman : jerk}
169 :
170 :
171 :
172 :
173 :
174 :
175 :
176 :
177 :
178 :
179 :
180 :
181 :
182 :
183 :
184 :
185 :
186 :
187 :
188 :
189 :
190 :
191 :
192 :
193 :
194 :
195 :
196 :
HM> quit
ENDOUT
__MACOSX/a1-code/._test_hash_main_data.sh
a1-code/test_read_deltas.o
a1-code/save_deltas.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "deltas.h"
#define MODE_TEXT 1
#define MODE_INT 2
#define MODE_4BIT 3
int main(int argc, char *argv[]){
if(argc < 3){
printf("usage: %s <format> <filename>n",argv[0]);
printf("reads input from stdin and outputs in given format to
<filename>n");
printf("if typing numbers in, press Ctrl-D to end inputn");
printf(" <format> is one ofn");
printf(" text : text ints are in the given filenamen");
printf(" int : binary ints are in the given filenamen");
printf(" 4bit : 4bit binary ints are in the given filenamen");
return 1;
}
char *format = argv[1];
char *fname = argv[2];
int mode = -1;
if( strcmp("text", format)==0 ){
mode = MODE_TEXT;
}
else if( strcmp("int", format)==0 ){
mode = MODE_INT;
}
else if( strcmp("4bit", format)==0 ){
mode = MODE_4BIT;
}
else{
printf("Unknown format '%s'n",format);
return 1;
}
FILE *fout = fopen(fname,"w");
int curr, prev;
int result = fscanf(stdin,"%d",&curr); // handle first number
if(result == EOF){
fclose(fout);
printf("error: no numbers givenn");
return 1;
}
if(mode == MODE_TEXT){
fprintf(fout,"%d ",curr);
}
else if(mode == MODE_INT || mode == MODE_4BIT ){
fwrite(&curr,sizeof(int),1,fout);
}
int count = 1;
prev=curr;
while(fscanf(stdin,"%d",&curr) != EOF){
if(mode == MODE_TEXT){
int delta = curr - prev;
fprintf(fout,"%d ",delta);
prev = curr;
count++;
}
else if(mode == MODE_INT){
int delta = curr - prev;
fwrite(&delta,sizeof(int),1,fout);
prev = curr;
count++;
}
else if(mode == MODE_4BIT){
int prev2 = prev;
prev = curr;
if(fscanf(stdin,"%d",&curr) == EOF){
printf("incorrect length of input for 4bit formatn");
fclose(fout);
return 1;
}
int delta1 = prev - prev2;
int delta2 = curr - prev;
// printf("[%d]: %dn",count,delta1);
// printf("[%d]: %dn",count+1,delta2);
if(delta1 > 7 || delta1 < -8 || delta2 > 7 || delta2 < -8){
printf("index %d: too large for 4bit: %d %dn",
count,delta1, delta2);
return 1;
}
char byte =
((delta1 << 0 ) & 0b00001111) |
((delta2 << 4 ) & 0b11110000);
fwrite(&byte, 1, 1, fout);
count+=2;
prev = curr;
}
}
if(MODE_TEXT){
fprintf(fout,"n");
}
fclose(fout);
printf("wrote %d ints to %s in %s formatn",
count, fname, format);
return 0;
}
__MACOSX/a1-code/._save_deltas.c
a1-code/make
a1-code/read_deltas.o
a1-code/graph_main.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "deltas.h"
#include <sys/types.h>
#include <sys/stat.h>
int main(int argc, char const *argv[]) {
if(argc < 3){
printf("usage: %s <format> <filename>n",argv[0]);
printf(" <format> is one ofn");
printf(" text : text ints are in the given filenamen");
printf(" int : binary ints are in the given filenamen");
printf(" 4bit : 4bit binary ints are in the given filenamen");
return 1;
}
char *format = argv[1];
char *fname = argv[2];
return 0;
}
__MACOSX/a1-code/._graph_main.c
a1-code/test_graph_file_data.sh
#!/bin/bash
T=0 # global test number
((T++))
tnames[T]="text-ten-5"
format[T]="text"
height[T]="5"
read -r -d '' input[$T] <<"ENDIN"
0 1 2 3 4 5 6 7 8 9 10
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Reading text format
length: 11
min: 0
max: 10
range: 10
max_height: 5
units_per_height: 2.00
+----+----+
10 | X
8 | XXX
6 | XXXXX
4 | XXXXXXX
2 | XXXXXXXXX
0 |XXXXXXXXXXX
+----+----+
0 5 10
ENDOUT
((T++))
tnames[T]="text-ten-20"
format[T]="text"
height[T]="20"
read -r -d '' input[$T] <<"ENDIN"
0 1 2 3 4 5 6 7 8 9 10
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Reading text format
length: 11
min: 0
max: 10
range: 10
max_height: 20
units_per_height: 0.50
+----+----+
10 | X
9 | XX
9 | XX
8 | XXX
8 | XXX
7 | XXXX
7 | XXXX
6 | XXXXX
6 | XXXXX
5 | XXXXXX
5 | XXXXXX
4 | XXXXXXX
4 | XXXXXXX
3 | XXXXXXXX
3 | XXXXXXXX
2 | XXXXXXXXX
2 | XXXXXXXXX
1 | XXXXXXXXXX
1 | XXXXXXXXXX
0 |XXXXXXXXXXX
0 |XXXXXXXXXXX
+----+----+
0 5 10
ENDOUT
((T++))
tnames[T]="text-21-5"
format[T]="text"
height[T]="5"
read -r -d '' input[$T] <<"ENDIN"
20 18 14 10 7 2 3 1 5 9 5 7 7 5 5 5 7 8 3 7 4
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Reading text format
length: 21
min: 1
max: 20
range: 19
max_height: 5
units_per_height: 3.80
+----+----+----+----+
20 |X
16 |XX
12 |XXX
8 |XXXX X X
4 |XXXXX XXXXXXXXXX XX
1 |XXXXXXXXXXXXXXXXXXXXX
+----+----+----+----+
0 5 10 15 20
ENDOUT
((T++))
tnames[T]="text-21-12"
format[T]="text"
height[T]="12"
read -r -d '' input[$T] <<"ENDIN"
20 18 14 10 7 2 3 1 5 9 5 7 7 5 5 5 7 8 3 7 4
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Reading text format
length: 21
min: 1
max: 20
range: 19
max_height: 12
units_per_height: 1.58
+----+----+----+----+
20 |X
18 |XX
16 |XX
15 |XX
13 |XXX
12 |XXX
10 |XXXX
8 |XXXX X X
7 |XXXXX X XX XX X
5 |XXXXX XXXXXXXXXX X
4 |XXXXX XXXXXXXXXX XX
2 |XXXXXXX XXXXXXXXXXXXX
1 |XXXXXXXXXXXXXXXXXXXXX
+----+----+----+----+
0 5 10 15 20
ENDOUT
((T++))
tnames[T]="int-21-7"
format[T]="int"
height[T]="7"
read -r -d '' input[$T] <<"ENDIN"
20 18 14 10 7 2 3 1 5 9 5 7 7 5 5 5 7 8 3 7 4
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Reading binary int format
length: 21
min: 1
max: 20
range: 19
max_height: 7
units_per_height: 2.71
+----+----+----+----+
20 |X
17 |XX
14 |XXX
11 |XXX
9 |XXXX X
6 |XXXXX X XX XX X
3 |XXXXX X XXXXXXXXXXXXX
1 |XXXXXXXXXXXXXXXXXXXXX
+----+----+----+----+
0 5 10 15 20
ENDOUT
((T++))
tnames[T]="int-21-15"
format[T]="int"
height[T]="15"
read -r -d '' input[$T] <<"ENDIN"
20 18 14 10 7 2 3 1 5 9 5 7 7 5 5 5 7 8 3 7 4
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Reading binary int format
length: 21
min: 1
max: 20
range: 19
max_height: 15
units_per_height: 1.27
+----+----+----+----+
20 |X
18 |XX
17 |XX
16 |XX
14 |XXX
13 |XXX
12 |XXX
11 |XXX
9 |XXXX X
8 |XXXX X X
7 |XXXXX X XX XX X
6 |XXXXX X XX XX X
4 |XXXXX XXXXXXXXXX XX
3 |XXXXX X XXXXXXXXXXXXX
2 |XXXXXXX XXXXXXXXXXXXX
1 |XXXXXXXXXXXXXXXXXXXXX
+----+----+----+----+
0 5 10 15 20
ENDOUT
((T++))
tnames[T]="text-wave-8"
format[T]="text"
height[T]="8"
read -r -d '' input[$T] <<"ENDIN"
0 2 4 6 8 10 11 13 14 16 17 18 19 19 20 20 20 20 19 19 18 17
16 15 14 12 10 9 7 5 3 1 -1 -3 -5 -7 -9 -11 -12 -14 -15 -16 -17 -
18 -19 -20 -20 -20 -20 -20 -19 -19 -18 -17 -15 -14 -13 -11 -9 -7
-6 -4 -2 0 2 4 6 8 10 11 13 14 16 17 18 19 19 20 20 20 20 19 19
18 17 16 15 14 12 10 9 7 5 3 1 -1 -3 -5 -7 -9 -11 -12 -14 -15 -16
-17 -18 -19 -20 -20 -20 -20 -20 -19 -19 -18 -17 -15 -14 -13 -11 -
9 -7 -6 -4 -2 0
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Reading text format
length: 127
min: -20
max: 20
range: 40
max_height: 8
units_per_height: 5.00
+----+----+----+----+----+----+----+----+----+----+----+----+--
--+----+----+----+----+----+----+----+----+----+----+----+----+-
20 | XXXX
XXXX
15 | XXXXXXXXXXXXXXX
XXXXXXXXXXXXXXX
10 | XXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXX
5 | XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXX
0 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X
-5 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX
-10
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX XXXXXX
-15
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXX XXXXXXXXXX
-20
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXX
+----+----+----+----+----+----+----+----+----+----+----+----+--
--+----+----+----+----+----+----+----+----+----+----+----+----+-
0 5 10 15 20 25 30 35 40 45 50 55 60 65
70 75 80 85 90 95 100 105 110 115 120 125
ENDOUT
((T++))
tnames[T]="int-wave-15"
format[T]="int"
height[T]="15"
read -r -d '' input[$T] <<"ENDIN"
0 2 4 6 8 10 11 13 14 16 17 18 19 19 20 20 20 20 19 19 18 17
16 15 14 12 10 9 7 5 3 1 -1 -3 -5 -7 -9 -11 -12 -14 -15 -16 -17 -
18 -19 -20 -20 -20 -20 -20 -19 -19 -18 -17 -15 -14 -13 -11 -9 -7
-6 -4 -2 0 2 4 6 8 10 11 13 14 16 17 18 19 19 20 20 20 20 19 19
18 17 16 15 14 12 10 9 7 5 3 1 -1 -3 -5 -7 -9 -11 -12 -14 -15 -16
-17 -18 -19 -20 -20 -20 -20 -20 -19 -19 -18 -17 -15 -14 -13 -11 -
9 -7 -6 -4 -2 0
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Reading binary int format
length: 127
min: -20
max: 20
range: 40
max_height: 15
units_per_height: 2.67
+----+----+----+----+----+----+----+----+----+----+----+----+--
--+----+----+----+----+----+----+----+----+----+----+----+----+-
20 | XXXX
XXXX
17 | XXXXXXXXXXXX
XXXXXXXXXXXX
14 | XXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX
12 | XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXX
9 | XXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXX
6 | XXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXX
4 | XXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXX
1 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-1 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X
-4 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX
-6 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX
-9
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX XXXXXX
-12
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXX XXXXXXX
-14
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXX XXXXXXXXX
-17
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXX XXXXXXXXXXX
-20
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXX
+----+----+----+----+----+----+----+----+----+----+----+----+--
--+----+----+----+----+----+----+----+----+----+----+----+----+-
0 5 10 15 20 25 30 35 40 45 50 55 60 65
70 75 80 85 90 95 100 105 110 115 120 125
ENDOUT
((T++))
tnames[T]="text-rand-14"
format[T]="text"
height[T]="14"
read -r -d '' input[$T] <<"ENDIN"
18 9 84 26 41 90 60 61 78 17 71 38 24 83 18 53 85 79 21 36 16
14 52 95 21 34 11 42 95 71 49 7 58 77 62 84 24 14 47 8 87 94
96 17 55 75 89 73 79 94 76 37 59 66 86 92 15 7 75 30 67 7 5 42
55 39 2 75 81 26 14 59 48 59 89 25 96 77 35 36 46 26 8 47 7 15
47 98 75 67 90 5 83 85 43 90 40 94 43 84 38 75 22 13 37 77 83
13 12 9 18 67 79 39 61 83 52 72 34 63 44 5 14 51 14 49 91 24
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Reading text format
length: 128
min: 2
max: 98
range: 96
max_height: 14
units_per_height: 6.86
+----+----+----+----+----+----+----+----+----+----+----+----+--
--+----+----+----+----+----+----+----+----+----+----+----+----+--
98 |
X
91 | X X XX X X X
X X X
84 | X X X X X X XXX X X XX
X X X X X X X X X
77 | X X X X XX X X X X XXX X XX XX
X X XX X X XX X X X XX X X X
70 | X X X X X XX X XX X X XXX XXXXXX
XX X XX X XX XX X XX X X X X XX X X
X X
63 | X X X X X XX X XX X X XXX XXXXXX
XXX X X XX X XX XXXX XX X X X X XX
XX X X X X
56 | X XXXX X X XX X XX XXXX XXX XXXXXX
XXXX X X XX X XX XX XXXX XX X X X X XX
XX XX X X X
50 | X XXXX X X XXX XX XX XXXX XXX
XXXXXXX XXXX X X X XX X XX XX XXXX XX X
X X X XX XX XXXX X X X
43 | X XXXX X X XXX XX XXX XXXX X XXX
XXXXXXX XXXX X X X XX XXXX XX X X XXXXX
XXXX XXX X XX XX XXXX XX X XX
36 | X XXXXX XX X XXX X XX XXXX XXXX X XXX
XXXXXXXXXXXX X X XXX XX XXXX XX XX X
XXXXX XXXXXXXXXX XXX XXXXXXX XX X XX
29 | X XXXXX XX X XXX X XX X XXXX XXXX X XXX
XXXXXXXXXXXX XXX XXX XX XXXX XXXXX X
XXXXX XXXXXXXXXX XXX XXXXXXXXXX X XX
22 | XXXXXXX XXXX XXX X XX X XXXX XXXXX X
XXX XXXXXXXXXXXX XXX XXX XXX XXXXXXXXXXX
X XXXXX XXXXXXXXXXX XXX XXXXXXXXXX X
XXX
15 |X XXXXXXXXXXXXXXXXXXX XXXX XXXX XXXXX
X XXXXXXXXXXXXXXXXX XXX XXX XXX
XXXXXXXXXXX X XXXXXX XXXXXXXXXXX XXX
XXXXXXXXXXX X XXX
8 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX
XXXXXXXXXXXXXXXXX XXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX
2
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXX
+----+----+----+----+----+----+----+----+----+----+----+----+--
--+----+----+----+----+----+----+----+----+----+----+----+----+--
0 5 10 15 20 25 30 35 40 45 50 55 60 65
70 75 80 85 90 95 100 105 110 115 120 125
ENDOUT
((T++))
tnames[T]="int-rand-32"
format[T]="text"
height[T]="32"
read -r -d '' input[$T] <<"ENDIN"
18 9 84 26 41 90 60 61 78 17 71 38 24 83 18 53 85 79 21 36 16
14 52 95 21 34 11 42 95 71 49 7 58 77 62 84 24 14 47 8 87 94
96 17 55 75 89 73 79 94 76 37 59 66 86 92 15 7 75 30 67 7 5 42
55 39 2 75 81 26 14 59 48 59 89 25 96 77 35 36 46 26 8 47 7 15
47 98 75 67 90 5 83 85 43 90 40 94 43 84 38 75 22 13 37 77 83
13 12 9 18 67 79 39 61 83 52 72 34 63 44 5 14 51 14 49 91 24
ENDIN
#
read -r -d '' output[$T] <<"ENDOUT"
Reading text format
length: 128
min: 2
max: 98
range: 96
max_height: 32
units_per_height: 3.00
+----+----+----+----+----+----+----+----+----+----+----+----+--
--+----+----+----+----+----+----+----+----+----+----+----+----+--
98 |
X
95 | X X X X
X
92 | X X XX X X X
X X
89 | X X X XX X X X X
X X X X X X
86 | X X X XXX X X XX
X X X X X X X
83 | X X X X X X X XXX X X XX
X X X X XX X X X X X X
80 | X X X X X X X XXX X X XX
X X X X X XX X X X X X X
77 | X X X X XX X X X X XXX X XX XX
X X XX X X XX X X X XX X X X
74 | X X X X XX X X X X XXX XX XXX XX
X XX X XX XX X XX X X X X XX X X
X
71 | X X X X X XX X XX X X XXX XXXXXX
XX X XX X XX XX X XX X X X X XX X X
X X
68 | X X X X X XX X XX X X XXX XXXXXX
XX X XX X XX XX X XX X X X X XX X X
X X
65 | X X X X X XX X XX X X XXX XXXXXX
XXX X X XX X XX XXXX XX X X X X XX
XX X X X
62 | X X X X X XX X XX XXX XXX XXXXXX
XXX X X XX X XX XXXX XX X X X X XX
XX X X X X
59 | X XXXX X X XX X XX XXX XXX XXXXXX
XXXX X X XX X XX XX XXXX XX X X X X XX
XX XX X X X
56 | X XXXX X X XX X XX XXXX XXX XXXXXX
XXXX X X XX X XX XX XXXX XX X X X X XX
XX XX X X X
53 | X XXXX X X XXX X XX XXXX XXX
XXXXXXX XXXX X X X XX X XX XX XXXX XX X
X X X XX XX XX X X X
50 | X XXXX X X XXX XX XX XXXX XXX
XXXXXXX XXXX X X X XX X XX XX XXXX XX X
X X X XX XX XXXX X X X
47 | X XXXX X X XXX XX XXX XXXX X XXX
XXXXXXX XXXX X X X XX XXXX XX X XXXXX XX
X X X X XX XX XXXX X X XX
44 | X XXXX X X XXX XX XXX XXXX X XXX
XXXXXXX XXXX X X X XX XXXX XX X X XXXXX
XX X X X X XX XX XXXX XX X XX
41 | X XXXXX X X XXX XX XXXX XXXX X XXX
XXXXXXX XXXX X X XX XX XXXX XX X X XXXXX
XXXX XXX X XX XX XXXX XX X XX
38 | X XXXXX XX X XXX XX XXXX XXXX X XXX
XXXXXXX XXXX X X XXX XX XXXX XX X X XXXXX
XXXXXXXXXX XX XXXXXXX XX X XX
35 | X XXXXX XX X XXX X XX XXXX XXXX X XXX
XXXXXXXXXXXX X X XXX XX XXXX XXXXX X
XXXXX XXXXXXXXXX XXX XXXXXXX XX X XX
32 | X XXXXX XX X XXX X XX X XXXX XXXX X XXX
XXXXXXXXXXXX X X XXX XX XXXX XXXXX X
XXXXX XXXXXXXXXX XXX XXXXXXXXXX X XX
29 | X XXXXX XX X XXX X XX X XXXX XXXX X XXX
XXXXXXXXXXXX XXX XXX XX XXXX XXXXX X
XXXXX XXXXXXXXXX XXX XXXXXXXXXX X XX
26 | XXXXXXX XX X XXX X XX X XXXX XXXX X XXX
XXXXXXXXXXXX XXX XXX XXX XXXX XXXXXX X
XXXXX XXXXXXXXXX XXX XXXXXXXXXX X XX
23 | XXXXXXX XXXX XXX X XX X XXXX XXXXX X
XXX XXXXXXXXXXXX XXX XXX XXX XXXXXXXXXXX
X XXXXX XXXXXXXXXX XXX XXXXXXXXXX X XXX
20 | XXXXXXX XXXX XXXXX XXXX XXXX XXXXX X
XXX XXXXXXXXXXXX XXX XXX XXX XXXXXXXXXXX
X XXXXX XXXXXXXXXXX XXX XXXXXXXXXX X
XXX
17 |X XXXXXXXXXXXXXXXXXX XXXX XXXX XXXXX X
XXXXXXXXXXXXXXXX XXX XXX XXX
XXXXXXXXXXX X XXXXX XXXXXXXXXXX XXX
XXXXXXXXXXX X XXX
14 |X XXXXXXXXXXXXXXXXXXXXXXXX XXXX
XXXXXXX XXXXXXXXXXXXXXXXX XXX XXX
XXXXXXXXXXXXXXX X XXXXXX XXXXXXXXXXX XXX
XXXXXXXXXXX XXXXXX
11 |X XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXX XXXXXXXXXXXXXXXXX XXX XXX
XXXXXXXXXXXXXXX X XXXXXX
XXXXXXXXXXXXXXXXX XXXXXXXXXXX XXXXXX
8 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX
XXXXXXXXXXXXXXXXX XXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX
5
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXX
2
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXX
+----+----+----+----+----+----+----+----+----+----+----+----+--
--+----+----+----+----+----+----+----+----+----+----+----+----+--
0 5 10 15 20 25 30 35 40 45 50 55 60 65
70 75 80 85 90 95 100 105 110 115 120 125
ENDOUT
__MACOSX/a1-code/._test_graph_file_data.sh
a1-code/print_graph_demo.o
a1-code/deltas_main
a1-code/print_graph_demo
a1-code/data/short.actual.txt
20
18
14
10
7
2
3
1
5
9
5
7
7
5
5
5
7
8
3
7
4
__MACOSX/a1-code/data/._short.actual.txt
a1-code/data/names.txt
Mary
James
Patricia
John
Jennifer
Robert
Elizabeth
Michael
Linda
William
Barbara
David
Susan
Richard
Jessica
Joseph
Margaret
Thomas
Sarah
Charles
Karen
Christopher
Nancy
Daniel
Betty
Matthew
Lisa
Anthony
Dorothy
Donald
Sandra
Mark
Ashley
Paul
Kimberly
Steven
Donna
Andrew
Carol
Kenneth
Michelle
George
Emily
Joshua
Amanda
Kevin
Helen
Brian
Melissa
Edward
Deborah
Ronald
Stephanie
Timothy
Laura
Jason
Rebecca
Jeffrey
Sharon
Ryan
Cynthia
Gary
Kathleen
Jacob
Amy
Nicholas
Shirley
Eric
Anna
Stephen
Angela
Jonathan
Ruth
Larry
Brenda
Justin
Pamela
Scott
Nicole
Frank
Katherine
Brandon
Virginia
Raymond
Catherine
Gregory
Christine
Benjamin
Samantha
Samuel
Debra
Patrick
Janet
Alexander
Rachel
Jack
Carolyn
Dennis
Emma
Jerry
Maria
Tyler
Heather
Aaron
Diane
Henry
Julie
Douglas
Joyce
Jose
Evelyn
Peter
Frances
Adam
Joan
Zachary
Christina
Nathan
Kelly
Walter
Victoria
Harold
Lauren
Kyle
Martha
Carl
Judith
Arthur
Cheryl
Gerald
Megan
Roger
Andrea
Keith
Ann
Jeremy
Alice
Terry
Jean
Lawrence
Doris
Sean
Jacqueline
Christian
Kathryn
Albert
Hannah
Joe
Olivia
Ethan
Gloria
Austin
Marie
Jesse
Teresa
Willie
Sara
Billy
Janice
Bryan
Julia
Bruce
Grace
Jordan
Judy
Ralph
Theresa
Roy
Rose
Noah
Beverly
Dylan
Denise
Eugene
Marilyn
Wayne
Amber
Alan
Madison
Juan
Danielle
Louis
Brittany
Russell
Diana
Gabriel
Abigail
Randy
Jane
Philip
Natalie
Harry
Lori
Vincent
Tiffany
Bobby
Alexis
Johnny
Kayla
Logan
__MACOSX/a1-code/data/._names.txt
a1-code/data/big.script
put Mary girl
put James boy
put Patricia girl
put John boy
put Jennifer girl
put Robert boy
put Elizabeth girl
put Michael boy
put Linda girl
put William boy
put Barbara girl
put David boy
put Susan girl
put Richard boy
put Jessica girl
put Joseph boy
put Margaret girl
put Thomas boy
put Sarah girl
put Charles boy
put Karen girl
put Christopher boy
put Nancy girl
put Daniel boy
put Betty girl
put Matthew boy
put Lisa girl
put Anthony boy
put Dorothy girl
put Donald boy
put Sandra girl
put Mark boy
put Ashley girl
put Paul boy
put Kimberly girl
put Steven boy
put Donna girl
put Andrew boy
put Carol girl
put Kenneth boy
put Michelle girl
put George boy
put Emily girl
put Joshua boy
put Amanda girl
put Kevin boy
put Helen girl
put Brian boy
put Melissa girl
put Edward boy
put Deborah girl
put Ronald boy
put Stephanie girl
put Timothy boy
put Laura girl
put Jason boy
put Rebecca girl
put Jeffrey boy
put Sharon girl
put Ryan boy
put Cynthia girl
put Gary boy
put Kathleen girl
put Jacob boy
put Amy girl
put Nicholas boy
put Shirley girl
put Eric boy
put Anna girl
put Stephen boy
put Angela girl
put Jonathan boy
put Ruth girl
put Larry boy
put Brenda girl
put Justin boy
put Pamela girl
put Scott boy
put Nicole girl
put Frank boy
put Katherine girl
put Brandon boy
put Virginia girl
put Raymond boy
put Catherine girl
put Gregory boy
put Christine girl
put Benjamin boy
put Samantha girl
put Samuel boy
put Debra girl
put Patrick boy
put Janet girl
put Alexander boy
put Rachel girl
put Jack boy
put Carolyn girl
put Dennis boy
put Emma girl
put Jerry boy
put Maria girl
put Tyler boy
put Heather girl
put Aaron boy
put Diane girl
put Henry boy
put Julie girl
put Douglas boy
put Joyce girl
put Jose boy
put Evelyn girl
put Peter boy
put Frances girl
put Adam boy
put Joan girl
put Zachary boy
put Christina girl
put Nathan boy
put Kelly girl
put Walter boy
put Victoria girl
put Harold boy
put Lauren girl
put Kyle boy
put Martha girl
put Carl boy
put Judith girl
put Arthur boy
put Cheryl girl
put Gerald boy
put Megan girl
put Roger boy
put Andrea girl
put Keith boy
put Ann girl
put Jeremy boy
put Alice girl
put Terry boy
put Jean girl
put Lawrence boy
put Doris girl
put Sean boy
put Jacqueline girl
put Christian boy
put Kathryn girl
put Albert boy
put Hannah girl
put Joe boy
put Olivia girl
put Ethan boy
put Gloria girl
put Austin boy
put Marie girl
put Jesse boy
put Teresa girl
put Willie boy
put Sara girl
put Billy boy
put Janice girl
put Bryan boy
put Julia girl
put Bruce boy
put Grace girl
put Jordan boy
put Judy girl
put Ralph boy
put Theresa girl
put Roy boy
put Rose girl
put Noah boy
put Beverly girl
put Dylan boy
put Denise girl
put Eugene boy
put Marilyn girl
put Wayne boy
put Amber girl
put Alan boy
put Madison girl
put Juan boy
put Danielle girl
put Louis boy
put Brittany girl
put Russell boy
put Diana girl
put Gabriel boy
put Abigail girl
put Randy boy
put Jane girl
put Philip boy
put Natalie girl
put Harry boy
put Lori girl
put Vincent boy
put Tiffany girl
put Bobby boy
put Alexis girl
put Johnny boy
put Kayla girl
put Logan boy
expand
expand
expand
expand
structure
save big.hm
__MACOSX/a1-code/data/._big.script
a1-code/data/hash-demo.script~
add Lucas
add Mike
add Dustin
add Will
add El
print
preorder
find Mike
find Nancy
add Nancy
print
find Max
add Max
print
find Barb
add Barb
print
save stranger.tree
clear
print
add Demigorgon
print
load stranger.tree
preorder
add Jim
add Joyce
print
load stranger.tree
print
quit
__MACOSX/a1-code/data/._hash-demo.script~
a1-code/data/other.script
put Lucas brash
put Mike DM
put Dustin corny
put Will lost
print
get Dustin
get El
get Lucas
get Jim
put El weird
put Steve hairy
put Nancy torn
put Barb ran-away?
print
hashcode Lucas
hashcode Barb
structure
expand
structure
save stranger.hm
clear
print
structure
put Jim cop
put Joyce worried
print
structure
get Dustin
get Joyce
load stranger.hm
print
structure
get Dustin
get Joyce
put Will found
put Nancy decided
put Mike girl-crazy
print
structure
next_prime 10
next_prime 25
expand
structure
put Jim cop
put Joyce worried
put Erica capitalist
put Barb gone
put Max gamer
put Robin clever
save data/other.hm
quit
__MACOSX/a1-code/data/._other.script
a1-code/data/short.txt
20
-2
-4
-4
-3
-5
1
-2
4
4
-4
2
-0
-2
-0
0
2
1
-5
4
-3
__MACOSX/a1-code/data/._short.txt
a1-code/data/other.hm
23 8
El : weird
Barb : ran-away?
Lucas : brash
Dustin : corny
Nancy : decided
Mike : girl-crazy
Steve : hairy
Will : found
__MACOSX/a1-code/data/._other.hm
a1-code/data/big.script~
put Mary girl
put James boy
put Patricia girl
put John boy
put Jennifer girl
put Robert boy
put Elizabeth girl
put Michael boy
put Linda girl
put William boy
put Barbara girl
put David boy
put Susan girl
put Richard boy
put Jessica girl
put Joseph boy
put Margaret girl
put Thomas boy
put Sarah girl
put Charles boy
put Karen girl
put Christopher boy
put Nancy girl
put Daniel boy
put Betty girl
put Matthew boy
put Lisa girl
put Anthony boy
put Dorothy girl
put Donald boy
put Sandra girl
put Mark boy
put Ashley girl
put Paul boy
put Kimberly girl
put Steven boy
put Donna girl
put Andrew boy
put Carol girl
put Kenneth boy
put Michelle girl
put George boy
put Emily girl
put Joshua boy
put Amanda girl
put Kevin boy
put Helen girl
put Brian boy
put Melissa girl
put Edward boy
put Deborah girl
put Ronald boy
put Stephanie girl
put Timothy boy
put Laura girl
put Jason boy
put Rebecca girl
put Jeffrey boy
put Sharon girl
put Ryan boy
put Cynthia girl
put Gary boy
put Kathleen girl
put Jacob boy
put Amy girl
put Nicholas boy
put Shirley girl
put Eric boy
put Anna girl
put Stephen boy
put Angela girl
put Jonathan boy
put Ruth girl
put Larry boy
put Brenda girl
put Justin boy
put Pamela girl
put Scott boy
put Nicole girl
put Frank boy
put Katherine girl
put Brandon boy
put Virginia girl
put Raymond boy
put Catherine girl
put Gregory boy
put Christine girl
put Benjamin boy
put Samantha girl
put Samuel boy
put Debra girl
put Patrick boy
put Janet girl
put Alexander boy
put Rachel girl
put Jack boy
put Carolyn girl
put Dennis boy
put Emma girl
put Jerry boy
put Maria girl
put Tyler boy
put Heather girl
put Aaron boy
put Diane girl
put Henry boy
put Julie girl
put Douglas boy
put Joyce girl
put Jose boy
put Evelyn girl
put Peter boy
put Frances girl
put Adam boy
put Joan girl
put Zachary boy
put Christina girl
put Nathan boy
put Kelly girl
put Walter boy
put Victoria girl
put Harold boy
put Lauren girl
put Kyle boy
put Martha girl
put Carl boy
put Judith girl
put Arthur boy
put Cheryl girl
put Gerald boy
put Megan girl
put Roger boy
put Andrea girl
put Keith boy
put Ann girl
put Jeremy boy
put Alice girl
put Terry boy
put Jean girl
put Lawrence boy
put Doris girl
put Sean boy
put Jacqueline girl
put Christian boy
put Kathryn girl
put Albert boy
put Hannah girl
put Joe boy
put Olivia girl
put Ethan boy
put Gloria girl
put Austin boy
put Marie girl
put Jesse boy
put Teresa girl
put Willie boy
put Sara girl
put Billy boy
put Janice girl
put Bryan boy
put Julia girl
put Bruce boy
put Grace girl
put Jordan boy
put Judy girl
put Ralph boy
put Theresa girl
put Roy boy
put Rose girl
put Noah boy
put Beverly girl
put Dylan boy
put Denise girl
put Eugene boy
put Marilyn girl
put Wayne boy
put Amber girl
put Alan boy
put Madison girl
put Juan boy
put Danielle girl
put Louis boy
put Brittany girl
put Russell boy
put Diana girl
put Gabriel boy
put Abigail girl
put Randy boy
put Jane girl
put Philip boy
put Natalie girl
put Harry boy
put Lori girl
put Vincent boy
put Tiffany girl
put Bobby boy
put Alexis girl
put Johnny boy
put Kayla girl
put Logan boy
__MACOSX/a1-code/data/._big.script~
a1-code/data/other.script~
put Lucas brash
put Mike DM
put Dustin corny
put Will lost
print
get Dustin
get El
get Lucas
get Jim
put El weird
put Steve hairy
put Nancy torn
put Barb ran-away?
print
hashcode Lucas
hashcode Barb
structure
expand
structure
save stranger.hm
clear
print
structure
put Jim cop
put Joyce worried
print
structure
get Dustin
get Joyce
load stranger.hm
print
structure
get Dustin
get Joyce
put Will found
put Nancy decided
put Mike girl-crazy
print
structure
next_prime 10
next_prime 25
expand
structure
put Jim cop
put Joyce worried
put Erica capitalist
put Barb gone
put Max gamer
save data/other.hm
quit
__MACOSX/a1-code/data/._other.script~
a1-code/data/names.org
| 1 | James | 4,815,847 | Mary | 3,455,228 |
| 2 | John | 4,636,242 | Patricia | 1,565,291 |
| 3 | Robert | 4,600,785 | Jennifer | 1,464,890 |
| 4 | Michael | 4,307,070 | Elizabeth | 1,449,478 |
| 5 | William | 3,689,740 | Linda | 1,447,946 |
| 6 | David | 3,553,094 | Barbara | 1,413,261 |
| 7 | Richard | 2,496,587 | Susan | 1,106,614 |
| 8 | Joseph | 2,398,378 | Jessica | 1,042,177 |
| 9 | Thomas | 2,179,445 | Margaret | 1,016,433 |
| 10 | Charles | 2,161,838 | Sarah | 997,223 |
| 11 | Christopher | 2,010,788 | Karen | 984,334 |
| 12 | Daniel | 1,866,234 | Nancy | 976,066 |
| 13 | Matthew | 1,571,799 | Betty | 964,130 |
| 14 | Anthony | 1,394,023 | Lisa | 964,099 |
| 15 | Donald | 1,375,006 | Dorothy | 938,467 |
| 16 | Mark | 1,342,682 | Sandra | 872,927 |
| 17 | Paul | 1,316,094 | Ashley | 840,595 |
| 18 | Steven | 1,276,216 | Kimberly | 833,129 |
| 19 | Andrew | 1,241,121 | Donna | 825,431 |
| 20 | Kenneth | 1,241,110 | Carol | 810,032 |
| 21 | George | 1,225,477 | Michelle | 807,515 |
| 22 | Joshua | 1,192,510 | Emily | 806,210 |
| 23 | Kevin | 1,162,743 | Amanda | 771,396 |
| 24 | Brian | 1,161,909 | Helen | 754,741 |
| 25 | Edward | 1,146,548 | Melissa | 750,021 |
| 26 | Ronald | 1,073,427 | Deborah | 739,055 |
| 27 | Timothy | 1,063,014 | Stephanie | 736,098 |
| 28 | Jason | 1,023,728 | Laura | 729,905 |
| 29 | Jeffrey | 972,144 | Rebecca | 729,158 |
| 30 | Ryan | 916,701 | Sharon | 720,788 |
| 31 | Gary | 898,893 | Cynthia | 705,176 |
| 32 | Jacob | 892,543 | Kathleen | 696,019 |
| 33 | Nicholas | 881,085 | Amy | 677,725 |
| 34 | Eric | 870,654 | Shirley | 675,723 |
| 35 | Stephen | 841,664 | Anna | 661,870 |
| 36 | Jonathan | 826,440 | Angela | 656,616 |
| 37 | Larry | 802,374 | Ruth | 633,144 |
| 38 | Justin | 769,098 | Brenda | 605,962 |
| 39 | Scott | 768,539 | Pamela | 592,689 |
| 40 | Frank | 753,168 | Nicole | 583,727 |
| 41 | Brandon | 749,649 | Katherine | 581,835 |
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx
Hierarchies of LifeExperiment 1 Classification of Common Objects.docx

More Related Content

Similar to Hierarchies of LifeExperiment 1 Classification of Common Objects.docx

r studio presentation.pptx
r studio presentation.pptxr studio presentation.pptx
r studio presentation.pptxDevikaRaj14
 
r studio presentation.pptx
r studio presentation.pptxr studio presentation.pptx
r studio presentation.pptxDevikaRaj14
 
Τα Πολύ Βασικά για την Python
Τα Πολύ Βασικά για την PythonΤα Πολύ Βασικά για την Python
Τα Πολύ Βασικά για την PythonMoses Boudourides
 
An Introduction to the World of Testing for Front-End Developers
An Introduction to the World of Testing for Front-End DevelopersAn Introduction to the World of Testing for Front-End Developers
An Introduction to the World of Testing for Front-End DevelopersFITC
 
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...Haris Mahmood
 
Ds lab manual by s.k.rath
Ds lab manual by s.k.rathDs lab manual by s.k.rath
Ds lab manual by s.k.rathSANTOSH RATH
 
Fluent Refactoring (Lone Star Ruby Conf 2013)
Fluent Refactoring (Lone Star Ruby Conf 2013)Fluent Refactoring (Lone Star Ruby Conf 2013)
Fluent Refactoring (Lone Star Ruby Conf 2013)Sam Livingston-Gray
 
Bigger Data v Better Math
Bigger Data v Better MathBigger Data v Better Math
Bigger Data v Better MathBrent Schneeman
 
Automated tests - facts and myths
Automated tests - facts and mythsAutomated tests - facts and myths
Automated tests - facts and mythsWojciech Sznapka
 
Set operators - derived tables and CTEs
Set operators - derived tables and CTEsSet operators - derived tables and CTEs
Set operators - derived tables and CTEsSteve Stedman
 
Set Operators, Derived Tables and CTEs
Set Operators, Derived Tables and CTEsSet Operators, Derived Tables and CTEs
Set Operators, Derived Tables and CTEsAaron Buma
 
Final examexamplesapr2013
Final examexamplesapr2013Final examexamplesapr2013
Final examexamplesapr2013Brent Heard
 
Python PCEP Tuples and Dictionaries
Python PCEP Tuples and DictionariesPython PCEP Tuples and Dictionaries
Python PCEP Tuples and DictionariesIHTMINSTITUTE
 
Python PCEP Tuples and Dictionaries
Python PCEP Tuples and DictionariesPython PCEP Tuples and Dictionaries
Python PCEP Tuples and DictionariesIHTMINSTITUTE
 
Deep Learning: Introduction & Chapter 5 Machine Learning Basics
Deep Learning: Introduction & Chapter 5 Machine Learning BasicsDeep Learning: Introduction & Chapter 5 Machine Learning Basics
Deep Learning: Introduction & Chapter 5 Machine Learning BasicsJason Tsai
 
Quality Assurance 2: Searching for Bugs
Quality Assurance 2: Searching for BugsQuality Assurance 2: Searching for Bugs
Quality Assurance 2: Searching for BugsMarc Miquel
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfsagar414433
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfsagar414433
 

Similar to Hierarchies of LifeExperiment 1 Classification of Common Objects.docx (20)

r studio presentation.pptx
r studio presentation.pptxr studio presentation.pptx
r studio presentation.pptx
 
r studio presentation.pptx
r studio presentation.pptxr studio presentation.pptx
r studio presentation.pptx
 
Τα Πολύ Βασικά για την Python
Τα Πολύ Βασικά για την PythonΤα Πολύ Βασικά για την Python
Τα Πολύ Βασικά για την Python
 
An Introduction to the World of Testing for Front-End Developers
An Introduction to the World of Testing for Front-End DevelopersAn Introduction to the World of Testing for Front-End Developers
An Introduction to the World of Testing for Front-End Developers
 
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...
 
Ds lab manual by s.k.rath
Ds lab manual by s.k.rathDs lab manual by s.k.rath
Ds lab manual by s.k.rath
 
Next Level Testing
Next Level TestingNext Level Testing
Next Level Testing
 
Fluent Refactoring (Lone Star Ruby Conf 2013)
Fluent Refactoring (Lone Star Ruby Conf 2013)Fluent Refactoring (Lone Star Ruby Conf 2013)
Fluent Refactoring (Lone Star Ruby Conf 2013)
 
Bigger Data v Better Math
Bigger Data v Better MathBigger Data v Better Math
Bigger Data v Better Math
 
Automated tests - facts and myths
Automated tests - facts and mythsAutomated tests - facts and myths
Automated tests - facts and myths
 
Set operators - derived tables and CTEs
Set operators - derived tables and CTEsSet operators - derived tables and CTEs
Set operators - derived tables and CTEs
 
Set Operators, Derived Tables and CTEs
Set Operators, Derived Tables and CTEsSet Operators, Derived Tables and CTEs
Set Operators, Derived Tables and CTEs
 
Final examexamplesapr2013
Final examexamplesapr2013Final examexamplesapr2013
Final examexamplesapr2013
 
Python PCEP Tuples and Dictionaries
Python PCEP Tuples and DictionariesPython PCEP Tuples and Dictionaries
Python PCEP Tuples and Dictionaries
 
Python PCEP Tuples and Dictionaries
Python PCEP Tuples and DictionariesPython PCEP Tuples and Dictionaries
Python PCEP Tuples and Dictionaries
 
C arrays
C arraysC arrays
C arrays
 
Deep Learning: Introduction & Chapter 5 Machine Learning Basics
Deep Learning: Introduction & Chapter 5 Machine Learning BasicsDeep Learning: Introduction & Chapter 5 Machine Learning Basics
Deep Learning: Introduction & Chapter 5 Machine Learning Basics
 
Quality Assurance 2: Searching for Bugs
Quality Assurance 2: Searching for BugsQuality Assurance 2: Searching for Bugs
Quality Assurance 2: Searching for Bugs
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdf
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdf
 

More from pooleavelina

httpswww.azed.govoelaselpsUse this to see the English Lang.docx
httpswww.azed.govoelaselpsUse this to see the English Lang.docxhttpswww.azed.govoelaselpsUse this to see the English Lang.docx
httpswww.azed.govoelaselpsUse this to see the English Lang.docxpooleavelina
 
httpscdnapisec.kaltura.comindex.phpextwidgetpreviewpartner_.docx
httpscdnapisec.kaltura.comindex.phpextwidgetpreviewpartner_.docxhttpscdnapisec.kaltura.comindex.phpextwidgetpreviewpartner_.docx
httpscdnapisec.kaltura.comindex.phpextwidgetpreviewpartner_.docxpooleavelina
 
httpsifes.orgsitesdefaultfilesbrijuni18countryreport_fi.docx
httpsifes.orgsitesdefaultfilesbrijuni18countryreport_fi.docxhttpsifes.orgsitesdefaultfilesbrijuni18countryreport_fi.docx
httpsifes.orgsitesdefaultfilesbrijuni18countryreport_fi.docxpooleavelina
 
httpfmx.sagepub.comField Methods DOI 10.117715258.docx
httpfmx.sagepub.comField Methods DOI 10.117715258.docxhttpfmx.sagepub.comField Methods DOI 10.117715258.docx
httpfmx.sagepub.comField Methods DOI 10.117715258.docxpooleavelina
 
httpsiexaminer.orgfake-news-personal-responsibility-must-trump.docx
httpsiexaminer.orgfake-news-personal-responsibility-must-trump.docxhttpsiexaminer.orgfake-news-personal-responsibility-must-trump.docx
httpsiexaminer.orgfake-news-personal-responsibility-must-trump.docxpooleavelina
 
http1500cms.comBECAUSE THIS FORM IS USED BY VARIOUS .docx
http1500cms.comBECAUSE THIS FORM IS USED BY VARIOUS .docxhttp1500cms.comBECAUSE THIS FORM IS USED BY VARIOUS .docx
http1500cms.comBECAUSE THIS FORM IS USED BY VARIOUS .docxpooleavelina
 
httpswww.medicalnewstoday.comarticles323444.phphttpsasco.docx
httpswww.medicalnewstoday.comarticles323444.phphttpsasco.docxhttpswww.medicalnewstoday.comarticles323444.phphttpsasco.docx
httpswww.medicalnewstoday.comarticles323444.phphttpsasco.docxpooleavelina
 
httpstheater.nytimes.com mem theater treview.htmlres=9902e6.docx
httpstheater.nytimes.com mem theater treview.htmlres=9902e6.docxhttpstheater.nytimes.com mem theater treview.htmlres=9902e6.docx
httpstheater.nytimes.com mem theater treview.htmlres=9902e6.docxpooleavelina
 
httpsfitsmallbusiness.comemployee-compensation-planThe pu.docx
httpsfitsmallbusiness.comemployee-compensation-planThe pu.docxhttpsfitsmallbusiness.comemployee-compensation-planThe pu.docx
httpsfitsmallbusiness.comemployee-compensation-planThe pu.docxpooleavelina
 
httpsdoi.org10.11770002764219842624American Behaviora.docx
httpsdoi.org10.11770002764219842624American Behaviora.docxhttpsdoi.org10.11770002764219842624American Behaviora.docx
httpsdoi.org10.11770002764219842624American Behaviora.docxpooleavelina
 
httpsdoi.org10.11770896920516649418Critical Sociology.docx
httpsdoi.org10.11770896920516649418Critical Sociology.docxhttpsdoi.org10.11770896920516649418Critical Sociology.docx
httpsdoi.org10.11770896920516649418Critical Sociology.docxpooleavelina
 
httpsdoi.org10.11770894318420903495Nursing Science Qu.docx
httpsdoi.org10.11770894318420903495Nursing Science Qu.docxhttpsdoi.org10.11770894318420903495Nursing Science Qu.docx
httpsdoi.org10.11770894318420903495Nursing Science Qu.docxpooleavelina
 
httpswww.youtube.comwatchtime_continue=8&v=rFV0aes0vYAN.docx
httpswww.youtube.comwatchtime_continue=8&v=rFV0aes0vYAN.docxhttpswww.youtube.comwatchtime_continue=8&v=rFV0aes0vYAN.docx
httpswww.youtube.comwatchtime_continue=8&v=rFV0aes0vYAN.docxpooleavelina
 
httphps.orgdocumentspregnancy_fact_sheet.pdfhttpswww.docx
httphps.orgdocumentspregnancy_fact_sheet.pdfhttpswww.docxhttphps.orgdocumentspregnancy_fact_sheet.pdfhttpswww.docx
httphps.orgdocumentspregnancy_fact_sheet.pdfhttpswww.docxpooleavelina
 
httpswww.worldbank.orgencountryvietnamoverview---------.docx
httpswww.worldbank.orgencountryvietnamoverview---------.docxhttpswww.worldbank.orgencountryvietnamoverview---------.docx
httpswww.worldbank.orgencountryvietnamoverview---------.docxpooleavelina
 
HTML WEB Page solutionAbout.htmlQuantum PhysicsHomeServicesAbou.docx
HTML WEB Page solutionAbout.htmlQuantum PhysicsHomeServicesAbou.docxHTML WEB Page solutionAbout.htmlQuantum PhysicsHomeServicesAbou.docx
HTML WEB Page solutionAbout.htmlQuantum PhysicsHomeServicesAbou.docxpooleavelina
 
httpswww.huffpost.comentryonline-dating-vs-offline_b_4037867.docx
httpswww.huffpost.comentryonline-dating-vs-offline_b_4037867.docxhttpswww.huffpost.comentryonline-dating-vs-offline_b_4037867.docx
httpswww.huffpost.comentryonline-dating-vs-offline_b_4037867.docxpooleavelina
 
httpswww.vitalsource.comproductscomparative-criminal-justice-.docx
httpswww.vitalsource.comproductscomparative-criminal-justice-.docxhttpswww.vitalsource.comproductscomparative-criminal-justice-.docx
httpswww.vitalsource.comproductscomparative-criminal-justice-.docxpooleavelina
 
httpswww.nationaleatingdisorders.orglearnby-eating-disordera.docx
httpswww.nationaleatingdisorders.orglearnby-eating-disordera.docxhttpswww.nationaleatingdisorders.orglearnby-eating-disordera.docx
httpswww.nationaleatingdisorders.orglearnby-eating-disordera.docxpooleavelina
 
httpswww.youtube.comwatchtime_continue=59&v=Bh_oEYX1zNM&featu.docx
httpswww.youtube.comwatchtime_continue=59&v=Bh_oEYX1zNM&featu.docxhttpswww.youtube.comwatchtime_continue=59&v=Bh_oEYX1zNM&featu.docx
httpswww.youtube.comwatchtime_continue=59&v=Bh_oEYX1zNM&featu.docxpooleavelina
 

More from pooleavelina (20)

httpswww.azed.govoelaselpsUse this to see the English Lang.docx
httpswww.azed.govoelaselpsUse this to see the English Lang.docxhttpswww.azed.govoelaselpsUse this to see the English Lang.docx
httpswww.azed.govoelaselpsUse this to see the English Lang.docx
 
httpscdnapisec.kaltura.comindex.phpextwidgetpreviewpartner_.docx
httpscdnapisec.kaltura.comindex.phpextwidgetpreviewpartner_.docxhttpscdnapisec.kaltura.comindex.phpextwidgetpreviewpartner_.docx
httpscdnapisec.kaltura.comindex.phpextwidgetpreviewpartner_.docx
 
httpsifes.orgsitesdefaultfilesbrijuni18countryreport_fi.docx
httpsifes.orgsitesdefaultfilesbrijuni18countryreport_fi.docxhttpsifes.orgsitesdefaultfilesbrijuni18countryreport_fi.docx
httpsifes.orgsitesdefaultfilesbrijuni18countryreport_fi.docx
 
httpfmx.sagepub.comField Methods DOI 10.117715258.docx
httpfmx.sagepub.comField Methods DOI 10.117715258.docxhttpfmx.sagepub.comField Methods DOI 10.117715258.docx
httpfmx.sagepub.comField Methods DOI 10.117715258.docx
 
httpsiexaminer.orgfake-news-personal-responsibility-must-trump.docx
httpsiexaminer.orgfake-news-personal-responsibility-must-trump.docxhttpsiexaminer.orgfake-news-personal-responsibility-must-trump.docx
httpsiexaminer.orgfake-news-personal-responsibility-must-trump.docx
 
http1500cms.comBECAUSE THIS FORM IS USED BY VARIOUS .docx
http1500cms.comBECAUSE THIS FORM IS USED BY VARIOUS .docxhttp1500cms.comBECAUSE THIS FORM IS USED BY VARIOUS .docx
http1500cms.comBECAUSE THIS FORM IS USED BY VARIOUS .docx
 
httpswww.medicalnewstoday.comarticles323444.phphttpsasco.docx
httpswww.medicalnewstoday.comarticles323444.phphttpsasco.docxhttpswww.medicalnewstoday.comarticles323444.phphttpsasco.docx
httpswww.medicalnewstoday.comarticles323444.phphttpsasco.docx
 
httpstheater.nytimes.com mem theater treview.htmlres=9902e6.docx
httpstheater.nytimes.com mem theater treview.htmlres=9902e6.docxhttpstheater.nytimes.com mem theater treview.htmlres=9902e6.docx
httpstheater.nytimes.com mem theater treview.htmlres=9902e6.docx
 
httpsfitsmallbusiness.comemployee-compensation-planThe pu.docx
httpsfitsmallbusiness.comemployee-compensation-planThe pu.docxhttpsfitsmallbusiness.comemployee-compensation-planThe pu.docx
httpsfitsmallbusiness.comemployee-compensation-planThe pu.docx
 
httpsdoi.org10.11770002764219842624American Behaviora.docx
httpsdoi.org10.11770002764219842624American Behaviora.docxhttpsdoi.org10.11770002764219842624American Behaviora.docx
httpsdoi.org10.11770002764219842624American Behaviora.docx
 
httpsdoi.org10.11770896920516649418Critical Sociology.docx
httpsdoi.org10.11770896920516649418Critical Sociology.docxhttpsdoi.org10.11770896920516649418Critical Sociology.docx
httpsdoi.org10.11770896920516649418Critical Sociology.docx
 
httpsdoi.org10.11770894318420903495Nursing Science Qu.docx
httpsdoi.org10.11770894318420903495Nursing Science Qu.docxhttpsdoi.org10.11770894318420903495Nursing Science Qu.docx
httpsdoi.org10.11770894318420903495Nursing Science Qu.docx
 
httpswww.youtube.comwatchtime_continue=8&v=rFV0aes0vYAN.docx
httpswww.youtube.comwatchtime_continue=8&v=rFV0aes0vYAN.docxhttpswww.youtube.comwatchtime_continue=8&v=rFV0aes0vYAN.docx
httpswww.youtube.comwatchtime_continue=8&v=rFV0aes0vYAN.docx
 
httphps.orgdocumentspregnancy_fact_sheet.pdfhttpswww.docx
httphps.orgdocumentspregnancy_fact_sheet.pdfhttpswww.docxhttphps.orgdocumentspregnancy_fact_sheet.pdfhttpswww.docx
httphps.orgdocumentspregnancy_fact_sheet.pdfhttpswww.docx
 
httpswww.worldbank.orgencountryvietnamoverview---------.docx
httpswww.worldbank.orgencountryvietnamoverview---------.docxhttpswww.worldbank.orgencountryvietnamoverview---------.docx
httpswww.worldbank.orgencountryvietnamoverview---------.docx
 
HTML WEB Page solutionAbout.htmlQuantum PhysicsHomeServicesAbou.docx
HTML WEB Page solutionAbout.htmlQuantum PhysicsHomeServicesAbou.docxHTML WEB Page solutionAbout.htmlQuantum PhysicsHomeServicesAbou.docx
HTML WEB Page solutionAbout.htmlQuantum PhysicsHomeServicesAbou.docx
 
httpswww.huffpost.comentryonline-dating-vs-offline_b_4037867.docx
httpswww.huffpost.comentryonline-dating-vs-offline_b_4037867.docxhttpswww.huffpost.comentryonline-dating-vs-offline_b_4037867.docx
httpswww.huffpost.comentryonline-dating-vs-offline_b_4037867.docx
 
httpswww.vitalsource.comproductscomparative-criminal-justice-.docx
httpswww.vitalsource.comproductscomparative-criminal-justice-.docxhttpswww.vitalsource.comproductscomparative-criminal-justice-.docx
httpswww.vitalsource.comproductscomparative-criminal-justice-.docx
 
httpswww.nationaleatingdisorders.orglearnby-eating-disordera.docx
httpswww.nationaleatingdisorders.orglearnby-eating-disordera.docxhttpswww.nationaleatingdisorders.orglearnby-eating-disordera.docx
httpswww.nationaleatingdisorders.orglearnby-eating-disordera.docx
 
httpswww.youtube.comwatchtime_continue=59&v=Bh_oEYX1zNM&featu.docx
httpswww.youtube.comwatchtime_continue=59&v=Bh_oEYX1zNM&featu.docxhttpswww.youtube.comwatchtime_continue=59&v=Bh_oEYX1zNM&featu.docx
httpswww.youtube.comwatchtime_continue=59&v=Bh_oEYX1zNM&featu.docx
 

Recently uploaded

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 

Recently uploaded (20)

TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 

Hierarchies of LifeExperiment 1 Classification of Common Objects.docx

  • 1. Hierarchies of LifeExperiment 1: Classification of Common Objects Data Tables (15 points) Post-Lab Questions 1. Did you find that the items grouped together as you worked down the flow chart had similar characteristics in terms of their appearance? What about function? (10 points) A lot of the groups had similar characteristics and function, until I looked deeper into then as I continued down the list of questions. For example, a candle and a Scentsy are similar in function and characteristics, as they both give off pleasant smells. But if you were to ask if they use fire, you’d be able to differentiate the two. 2. Do you feel that the questions asked were appropriate? What questions would you have asked to devise this classification flow chart? What objects would be grouped together with your system? (10 points) I had to look over the chart a few times and soon made sense of the flow. I found myself conflicted on some of the answers as well, not agreeing with some entirely. For example, I don’t think a hex nut is cylindrical or round. It has sides, similar to pens and pencils where the style if hex like. 3. Do you think it is more or less challenging to classify living organisms in comparison to objects? Why? (10 points) 4. Pick 10 household items (e.g. spoon, book, paper clip, etc.) and design a taxonomic classification system to categorize them, similar to the one in Figure 8. Make sure you ask enough yes/no questions so that each item ends up in its own box or category at the end. (10 points)
  • 2. Experiment 2: Classification of Organisms Data Tables (10 points) Table 2: Classification of Organisms Organism Domain Kingdom Defined Nucleus Mobile Photosynthesis Unicellular Salmonella Bacteria Genus No Yes Yes Yes Ants Eukarya Animalia Yes Yes No No Zoo Flagellate Eukarya Protozoa Yes Yes No Yes Wolf Eukarya Animalia
  • 4. No Yes No Death Cap Mushroom Eukarya Fungi Yes No No No Post-Lab Questions 1. Did this series of questions correctly organize each organism? Why or why not? (10 points) 2. Do you feel that the questions asked were appropriate? What questions would you have asked? (10 points) 3. Which kingdom do you believe is most challenging to categorize correctly? Explain your answer (10 points) ©eScience Labs, LLC 2018 a1-code/save_deltas.o a1-code/test_print_graph_data.sh #!/bin/bash T=0 # global test number ((T++)) tnames[T]="demo-test" # read -r -d '' output[$T] <<"ENDOUT" DEMO DATA 1 ===========
  • 5. length: 22 min: 0 max: 20 range: 20 max_height: 10 units_per_height: 2.00 +----+----+----+----+- 20 | X 18 | XX 16 | XXX 14 | XXXX 12 | XXXXX 10 | X XXXXXXX 8 | XXX XXXXXXXX 6 | XXXXX XXXXXXXXX 4 | XXXXXXX XXXXXXXXXX 2 | XXXXXXXXXXXXXXXXXXXX 0 |XXXXXXXXXXXXXXXXXXXXXX +----+----+----+----+- 0 5 10 15 20 DEMO DATA 2 =========== length: 22 min: 0 max: 20 range: 20 max_height: 20 units_per_height: 1.00 +----+----+----+----+- 20 | X 19 | X 18 | XX 17 | XX 16 | XXX 15 | XXX
  • 6. 14 | XXXX 13 | XXXX 12 | XXXXX 11 | XXXXX 10 | X XXXXXXX 9 | XX XXXXXXX 8 | XXX XXXXXXXX 7 | XXXX XXXXXXXX 6 | XXXXX XXXXXXXXX 5 | XXXXXX XXXXXXXXX 4 | XXXXXXX XXXXXXXXXX 3 | XXXXXXXX XXXXXXXXXX 2 | XXXXXXXXXXXXXXXXXXXX 1 | XXXXXXXXXXXXXXXXXXXXX 0 |XXXXXXXXXXXXXXXXXXXXXX +----+----+----+----+- 0 5 10 15 20 DEMO DATA 3 =========== length: 50 min: 13 max: 996 range: 983 max_height: 10 units_per_height: 98.30 +----+----+----+----+----+----+----+----+----+---- 996 | X 897 | X X X X 799 | X X X X X X X X X 701 | XX X X X XXX X XX XXX X X XX 602 | XX X X XX XXX X X XX XXXX XX X XX 504 | XX XXX XX XXX XX X XXX XXXX XX XX X XX 406 | XX X XXX XXXX XXX XX X XXX XXX XXXXXXXXXX X XX
  • 7. 307 | XXX X XXX XXXXXXXXXXX X XXXX XXXXXXXXXXXXXXX X XX 209 | XXX XXXXXXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXXX XX 111 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX 13 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX +----+----+----+----+----+----+----+----+----+---- 0 5 10 15 20 25 30 35 40 45 DEMO DATA 4 =========== length: 50 min: 13 max: 996 range: 983 max_height: 18 units_per_height: 54.61 +----+----+----+----+----+----+----+----+----+---- 996 | X 941 | X X 886 | X X X X 832 | X X X X X X 777 | X X X X XXX X X XXX XX 722 | XX X X X XXX X X XXX XX 668 | XX X X X XXX X XX XXXX X X XX 613 | XX X X XX XXX X XX XXXX XX X XX 559 | XX XXX XX XXX XX X XX XXXX X XX X XX 504 | XX XXX XX XXX XX X XXX XXXX XX XX X XX 449 | XX X XXX XXXX XXX XX X X XXX XXXX XX XX X XX 395 | XXX X XXX XXXX XXX XX X XXX XXX
  • 8. XXXXXXXXXX X XX 340 | XXX X XXX XXXXXXXXXXX X XXX XXXXXXXXXXXXXXX X XX 286 | XXX X XXX XXXXXXXXXXX X XXXX XXXXXXXXXXXXXXX X XX 231 | XXX X XXXXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXXX XX 176 | XXX XXXXXXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXXXXXX 122 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX 67 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX 13 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX +----+----+----+----+----+----+----+----+----+---- 0 5 10 15 20 25 30 35 40 45 ENDOUT __MACOSX/a1-code/._test_print_graph_data.sh a1-code/.DS_Store __MACOSX/a1-code/._.DS_Store a1-code/print_graph_demo.c #include <stdio.h> void print_graph(int *data, int len, int max_height); int main(int argc, char *argv[]){
  • 9. printf("DEMO DATA 1n"); printf("===========n"); int data1[22] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 10,}; int len1 = 22; print_graph(data1, len1, 10); printf("n"); printf("DEMO DATA 2n"); printf("===========n"); print_graph(data1, len1, 20); printf("n"); printf("DEMO DATA 3n"); printf("===========n"); int data2[50] = { 13 , 397, 813, 745, 154, 473, 212, 939, 593, 849, 247, 453, 662, 806, 478, 390, 996, 792, 929, 372, 603, 577, 146, 801, 276, 328, 422, 481, 438, 126, 701, 988, 555, 376, 674, 781, 795, 780, 415, 521, 581, 412, 701, 617, 367, 258, 704, 192, 869, 791, }; int len2 = 50; print_graph(data2, len2, 10); printf("n"); printf("DEMO DATA 4n"); printf("===========n"); print_graph(data2, len2, 18); printf("n"); return 0; }
  • 10. __MACOSX/a1-code/._print_graph_demo.c a1-code/deltas.txt 10 2 5 -2 -5 -5 -6 4 a1-code/test_hash_main.sh #!/bin/bash # tests for print_graph_demo, run as one of # > ./test_tree_main.sh # run everything # > ./test_tree_main.sh 2 # run only tests 2 # # 15 points for tests # 5 points for valgrind tests function major_sep(){ printf '%sn' '=====================================' } function minor_sep(){ printf '%sn' '-------------------------------------' } major_sep printf "PROBLEM 3 hash_main.cn" generate=1 run_norm=1 # run normal tests run_valg=1 # run valgrind tests valg_denom=3 # divide valgrind score by this for points # Determine column width of the terminal if [[ -z "$COLUMNS" ]]; then
  • 11. printf "Setting COLUMNS based on sttyn" COLUMNS=$(stty size | awk '{print $2}') fi if (($COLUMNS == 0)); then COLUMNS=126 fi printf "COLUMNS is $COLUMNSn" DIFF="diff -bBy -W $COLUMNS" # -b ignore whitespace, -B ignore blank lines, -y do side-by-side comparison, -W to increase width of columns VALGRIND="valgrind --leak-check=full --show-leak- kinds=all" INPUT=test-data/input.tmp # name for expected output file EXPECT=test-data/expect.tmp # name for expected output file ACTUAL=test-data/actual.tmp # name for actual output file DIFFOUT=test-data/diff.tmp # name for diff output file VALGOUT=test-data/valgrind.tmp # name for valgrind output file printf "Loading tests... " source test_hash_main_data.sh printf "%d tests loadedn" "$T" NTESTS=$T VTESTS=$T NPASS=0 NVALG=0
  • 12. all_tests=$(seq $NTESTS) case "$1" in norm) run_valg=0 shift ;; valg) run_norm=0 shift ;; esac # Check whether a single test is being run single_test=$1 if ((single_test > 0 && single_test <= NTESTS)); then printf "Running single TEST %dn" "$single_test" all_tests=$single_test NTESTS=1 VTESTS=1 else printf "Running %d testsn" "$NTESTS" fi # printf "tests: %sn" "$all_tests" printf "n" # Run normal tests: capture output and check against expected if [ "$run_norm" = "1" ]; then minor_sep printf "hash_main NORMAL TESTSn" for i in $all_tests; do printf "TEST %2d %-18s : " "$i" "${tnames[i]}" FAIL="0" # Run the test
  • 13. # run program with given input { printf "%sn" "${input[i]}" | ./hash_main -echo ; } >& $ACTUAL # generate expected output printf "%sn" "${output[i]}" > $EXPECT # Check for output differences, print side-by-side diff if problems if ! $DIFF $EXPECT $ACTUAL > $DIFFOUT then printf "FAIL: Output Incorrectn" minor_sep printf "INPUT:n%sn" "${input[i]}" # Mac OSX has a different version sed so use awk to add on the ACTUAL/EXPECT $DIFF <(awk 'BEGIN{print "***EXPECT OUTPUT***"} {print}' $EXPECT) <(awk 'BEGIN{print "***ACTUAL OUTPUT***"} {print}' $ACTUAL) > $DIFFOUT # regen the diff with the headers cat $DIFFOUT if [ "$generate" == "1" ]; then printf "%sn" "---FULL ACTUAL---" cat $ACTUAL echo fi minor_sep FAIL="1" fi if [ -n "${tfiles[i]}" ]; then # if there is an output file to check TEXPECT=test-data/texpect.tmp # name for expected output file TACTUAL="${tfiles[i]}" # name for actual output file
  • 14. TDIFFOUT=test-data/tdiff.tmp # name for diff output file # generate expected output printf "%sn" "${tfiles_expect[i]}" > $TEXPECT # Check for output differences, print side-by-side diff if problems if ! $DIFF $TEXPECT $TACTUAL > $TDIFFOUT then printf "FAIL: File %s incorrectn" "$TACTUAL" minor_sep printf "INPUT:n%sn" "${input[i]}" printf "OUTPUT: EXPECT vs ACTUALn" cat $TDIFFOUT if [ "$generate" == "1" ]; then printf "%sn" "---FULL ACTUAL---" cat $TACTUAL fi minor_sep FAIL="1" fi fi if (( FAIL == 0 )); then printf "OKn" ((NPASS++)) fi done printf "Finished:n" printf "%2d / %2d Normal correctn" "$NPASS" "$NTESTS" printf "n" fi #
  • 15. =============================================== ================================= # Run valgrind tests: check only for problems identified by valgrind if [ "$run_valg" = "1" ]; then minor_sep printf "hash_main.c VALGRIND TESTSn" for i in $all_tests; do printf "TEST %2d %-18s : " "$i" "${tnames[i]}" # run code through valgrind { printf "%sn" "${input[i]}" | $VALGRIND ./hash_main - echo ; } >& $VALGOUT # Check various outputs from valgrind if ! grep -q 'ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)' $VALGOUT || ! grep -q 'in use at exit: 0 bytes in 0 blocks' $VALGOUT || grep -q 'definitely lost: 0 bytes in 0 blocks' $VALGOUT; then printf "FAIL: Valgrind detected problemsn" minor_sep cat $VALGOUT minor_sep else printf "Valgrind OKn" ((NVALG++)) fi done printf "Finished:n" printf "%2d / %2d Valgrind correctn" "$NVALG" "$VTESTS"
  • 16. printf "n" fi NVALG=$((NVALG / valg_denom)) VTESTS=$((VTESTS / valg_denom)) major_sep printf "OVERALL:n" printf "%2d / %2d Normal correctn" "$NPASS" "$NTESTS" printf "%2d / %2d Valgrind pointsn" "$NVALG" "$VTESTS" printf "RESULTS: %d / %d points for normal/valgrind testsn" "$((NPASS+NVALG))" "$((NTESTS+VTESTS))" __MACOSX/a1-code/._test_hash_main.sh a1-code/test-data/README This directory is for files generated during testing. It must be present for tests to work but the contents may be safely ignored. Files in this directory may be safely removed. The provided Makefile target make clean-tests will do this. __MACOSX/a1-code/test-data/._README __MACOSX/a1-code/._test-data a1-code/test_graph_file.sh
  • 17. #!/bin/bash # # tests for graph_file executable, run as one of # > ./test_graph_file.sh # run everything # > ./test_graph_file.sh 2 # run only tests 2 # > ./test_graph_file.sh norm # run only normal tests # > ./test_graph_file.sh valg # run only valgrind tests # > ./test_graph_file.sh norm 2 # run only normal test 2 # > ./test_graph_file.sh valg 2 # run only vaglgrind test 2 # # 1 point(s) per 10 normal tests # 0-3 point(s) penalty for memory problems under Valgrind function major_sep(){ printf '%sn' '=====================================' } function minor_sep(){ printf '%sn' '-------------------------------------' } # major_sep # printf "PROBLEM 2B graph_file.cn" generate=1 run_norm=1 # run normal tests run_valg=1 # run valgrind tests valg_penalty_max=3 # maximum point deduction for valgrind problems VALGRIND="valgrind --leak-check=full --show-leak- kinds=all" DIFF="diff -bBy" # -b ignore whitespace, -B ignore blank lines, -y do side-by-side comparison INPUT=test-data/input.tmp # name for expected
  • 18. output file EXPECT=test-data/expect.tmp # name for expected output file ACTUAL=test-data/actual.tmp # name for actual output file DIFFOUT=test-data/testdiff.tmp # name for diff output file VALGOUT=test-data/valgrind.tmp # name for valgrind output file printf "Loading tests... " source test_graph_file_data.sh printf "%d tests loadedn" "$T" NTESTS=$T VTESTS=$T NPASS=0 NVALG=0 all_tests=$(seq $NTESTS) # Turn off normal/valgrind test sections case "$1" in norm) run_valg=0 shift ;; valg) run_norm=0 shift ;; esac # Check whether a single test is being run single_test=$1 if ((single_test > 0 && single_test <= NTESTS)); then
  • 19. printf "Running single TEST %dn" "$single_test" all_tests=$single_test NTESTS=1 VTESTS=1 else printf "Running %d testsn" "$NTESTS" fi # printf "tests: %sn" "$all_tests" printf "n" # Run normal tests: capture output and check against expected if [ "$run_norm" = "1" ]; then minor_sep printf "graph_file.c NORMAL TESTSn" for i in $all_tests; do printf "TEST %2d %-18s : " "$i" "${tnames[i]}" # Run the test # generate the input file printf "%sn" "${input[i]}" | ./save_deltas "${format[i]}" $INPUT > /dev/null # run program on input file { ./graph_file "${format[i]}" $INPUT "${height[i]}" ; } >& $ACTUAL # generate expected output printf "%sn" "${output[i]}" > $EXPECT # Check for failure, print side-by-side diff if problems if ! $DIFF $EXPECT $ACTUAL > $DIFFOUT then printf "FAIL: Output Incorrectn" minor_sep printf "INPUT:n%sn" "${input[i]}" printf "OUTPUT: EXPECT vs ACTUALn"
  • 20. cat $DIFFOUT if [ "$generate" == "1" ]; then printf "FULL ACTUALn" cat $ACTUAL fi minor_sep else printf "OKn" ((NPASS++)) fi done printf "Finishedn" printf "%2d / %2d Normal correctn" "$NPASS" "$NTESTS" printf "n" fi # =============================================== ================================= # Run valgrind tests: check only for problems identified by valgrind if [ "$run_valg" = "1" ]; then minor_sep printf "graph_file.c VALGRIND TESTSn" for i in $all_tests; do printf "TEST %2d %-18s : " "$i" "${tnames[i]}" # Run the test # generate the input file printf "%sn" "${input[i]}" | ./save_deltas "${format[i]}" $INPUT > /dev/null # run code through valgrind { $VALGRIND ./graph_file "${format[i]}" $INPUT
  • 21. "${height[i]}" ; } >& $VALGOUT # Check various outputs from valgrind if ! grep -q 'ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)' $VALGOUT || ! grep -q 'in use at exit: 0 bytes in 0 blocks' $VALGOUT || grep -q 'definitely lost: 0 bytes in 0 blocks' $VALGOUT; then printf "FAIL: Valgrind detected problemsn" minor_sep cat $VALGOUT minor_sep else printf "Valgrind OKn" ((NVALG++)) fi done printf "Finishedn" printf "%2d / %2d Valgrind correctn" "$NVALG" "$VTESTS" printf "n" fi major_sep printf "OVERALL:n" printf "%2d / %2d Normal correctn" "$NPASS" "$NTESTS" printf "%2d / %2d Valgrind correctn" "$NVALG" "$VTESTS" valg_penalty=$((VTESTS-NVALG)) if ((valg_penalty > valg_penalty_max)); then valg_penalty=$valg_penalty_max fi printf "Valgrind penalty: -%dn" "$valg_penalty"
  • 22. SCORE=$((NPASS-valg_penalty)) if ((SCORE < 0)); then SCORE=0; fi printf "RESULTS: %d / %d points for normal/valgrind testsn" "$SCORE" "$NTESTS" __MACOSX/a1-code/._test_graph_file.sh a1-code/read_deltas.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include "deltas.h" #include <sys/types.h> #include <sys/stat.h> int *read_text_deltas(char *fname, int *len){ int num = 0; int count = 0; FILE *fp; fp = fopen(fname,"r"); if(fp == NULL){ *len = -1; return NULL;
  • 23. } while(!feof(fp)){ fscanf(fp,"%d", &num); count++; } rewind(fp); int *arr = (int*) malloc(count * sizeof(int)); int i=1; fscanf(fp,"%d", &num); arr[i - 1] = num; while(!feof(fp)){ fscanf(fp,"%d", &num); arr[i] = num; //printf("%d %dn", i,arr[i-1] + num); arr[i] = arr[i-1] + num; i++; } *len = count - 1; fclose(fp); return arr; } int *read_int_deltas(char *fname, int *len){ struct stat buf; int num = 0; int result = stat(fname, &buf);
  • 24. if(result == -1 || buf.st_size < sizeof(int)){ return NULL; } int size = buf.st_size / 4; int *arr = (int*) malloc(size * sizeof(int)); FILE *fp; fp = fopen(fname,"r"); if(fp == NULL){ *len = -1; return NULL; } int i = 1; fread(&num,sizeof(int),1,fp); arr[i-1] = num; for(i = 1; i < size; i++){ fread(&num,sizeof(int),1,fp); //printf("%d %dn", i,arr[i-1] + num); arr[i] = arr[i-1] + num; } *len = size; fclose(fp); return arr; } __MACOSX/a1-code/._read_deltas.c a1-code/binary.int a1-code/Makefile CFLAGS = -Wall -g -lm
  • 25. CC = gcc $(CFLAGS) SHELL = /bin/bash CWD = $(shell pwd | sed 's/.*///g') PROGRAMS = save_deltas deltas_main print_graph_demo graph_file hash_main all : $(PROGRAMS) AN=a1 zip : rm -f $(AN)-code.zip cd .. && zip "$(CWD)/$(AN)-code.zip" -r "$(CWD)" @echo Zip created in $(AN)-code.zip @if (( $$(stat -c '%s' $(AN)-code.zip) > 10*(2**20) )); then echo "WARNING: $(AN)-code.zip seems REALLY big, check there are no abnormally large test files"; du -h $(AN)- code.zip; fi clean : rm -f $(PROGRAMS) *.o # int delta problem deltas_main.o : deltas_main.c deltas.h $(CC) -c $< deltas_main : deltas_main.o read_deltas.o $(CC) -o [email protected] $^ read_deltas.o : read_deltas.c deltas.h $(CC) -c $<
  • 26. save_deltas.o : save_deltas.c deltas.h $(CC) -c $< save_deltas : save_deltas.o $(CC) -o [email protected] $^ # print_graph print_graph.o : print_graph.c $(CC) -c $< print_graph_demo.o : print_graph_demo.c $(CC) -c $< print_graph_demo : print_graph_demo.o print_graph.o $(CC) -o [email protected] $^ graph_file.o : graph_file.c $(CC) -c $< graph_file : graph_file.o print_graph.o read_deltas.o $(CC) -o [email protected] $^ # hash problem hash_main : hash_main.o hash_funcs.o $(CC) -o [email protected] $^ hash_main.o : hash_main.c hashmap.h $(CC) -c $< hash_funcs.o : hash_funcs.c hashmap.h $(CC) -c $< # Testing Targets
  • 27. VALGRIND = valgrind --leak-check=full --show-leak-kinds=all test : test-p1 test-p2 test-p3 test-p1 : test-p1-norm test-p1-valg test-p1-norm : test_read_deltas @printf "===P1 Normal tests for read_deltas() via test_read_deltas===n" ./test_read_deltas @printf "n" test-p1-valg : test_read_deltas @printf "n" @printf "===P1 Valgrind tests for read_deltas() via test_read_deltas===n" @echo $(VALGRIND) ./test_read_deltas @$(VALGRIND) ./test_read_deltas >& test-data/p1- valgrind.tmp @chmod u+rx ./test_check_valgrind.sh @./test_check_valgrind.sh 5 'PROBLEM 1 Valgrind Memory Checks' test-data/p1-valgrind.tmp @printf "n" test_read_deltas.o : test_read_deltas.c deltas.h $(CC) -c $< test_read_deltas : test_read_deltas.o read_deltas.o $(CC) -o [email protected] $^ test-p2 : test-p2a test-p2b test-p2a : print_graph_demo graph_file save_deltas @printf "===TESTS for P2A===n" @printf "Testing print_graph() via print_graph_demon"
  • 28. @chmod u+rx ./test_print_graph.sh ./test_print_graph.sh test-p2b : print_graph_demo graph_file save_deltas @printf "===TESTS for P2B===n" @printf "Testing graph_filen" @chmod u+rx ./test_graph_file.sh ./test_graph_file.sh test-p3 : hash_main @printf "===TESTS for P3===n" @chmod u+rx ./test_hash_main.sh ./test_hash_main.sh clean-tests : rm -f test_read_deltas rm -f test-data/*.tmp test-data/*.tree __MACOSX/a1-code/._Makefile a1-code/test_print_graph.sh #!/bin/bash # # tests for print_graph_demo, run as one of # > ./test_print_graph.sh # run everything # > ./test_print_graph.sh 2 # run only tests 2 # > ./test_print_graph.sh norm # run only normal tests # > ./test_print_graph.sh valg # run only valgrind tests # > ./test_print_graph.sh norm 2 # run only normal test 2 # > ./test_print_graph.sh valg 2 # run only vaglgrind test 2 # # 4 point(s) for the single normal test # 1 point(s) for avoiding memory problems under Valgrind
  • 29. function major_sep(){ printf '%sn' '=====================================' } function minor_sep(){ printf '%sn' '-------------------------------------' } # major_sep # printf "PROBLEM 2A print_graph_demo.cn" generate=1 run_norm=1 # run normal tests run_valg=1 # run valgrind tests norm_mult=4 # weighting for normal tests valg_mult=1 # weighting for valgrind tests VALGRIND="valgrind --leak-check=full --show-leak- kinds=all" DIFF="diff -bBy" # -b ignore whitespace, -B ignore blank lines, -y do side-by-side comparison INPUT=test-data/input.tmp # name for expected output file EXPECT=test-data/expect.tmp # name for expected output file ACTUAL=test-data/actual.tmp # name for actual output file DIFFOUT=test-data/diff.tmp # name for diff output file VALGOUT=test-data/valgrind.tmp # name for valgrind output file printf "Loading tests... " source test_print_graph_data.sh
  • 30. printf "%d tests loadedn" "$T" NTESTS=$T VTESTS=$T NPASS=0 NVALG=0 all_tests=$(seq $NTESTS) case "$1" in norm) run_valg=0 shift ;; valg) run_norm=0 shift ;; esac # Check whether a single test is being run single_test=$1 if ((single_test > 0 && single_test <= NTESTS)); then printf "Running single TEST %dn" "$single_test" all_tests=$single_test NTESTS=1 VTESTS=1 else printf "Running %d testsn" "$NTESTS" fi printf "tests: %sn" "$all_tests" printf "n" # Run normal tests: capture output and check against expected
  • 31. if [ "$run_norm" = "1" ]; then minor_sep printf "print_graph_demo NORMAL TESTSn" for i in $all_tests; do printf "TEST %2d %-18s : " "$i" "${tnames[i]}" # run program on input file { ./print_graph_demo ; } >& $ACTUAL # generate expected output printf "%sn" "${output[i]}" > $EXPECT # Check for failure, print side-by-side diff if problems if ! $DIFF $EXPECT $ACTUAL > $DIFFOUT then printf "FAIL: Output Incorrectn" minor_sep printf "INPUT:n%sn" "${input[i]}" printf "OUTPUT: EXPECT vs ACTUALn" cat $DIFFOUT if [ "$generate" == "1" ]; then printf "FULL ACTUALn" cat $ACTUAL fi minor_sep else printf "OKn" ((NPASS++)) fi done printf "Finishedn" major_sep printf "%2d / %2d Normal correctn" "$((NPASS*norm_mult))" "$((NTESTS*norm_mult))" printf "n"
  • 32. fi # =============================================== ================================= # Run valgrind tests: check only for problems identified by valgrind if [ "$run_valg" = "1" ]; then minor_sep printf "print_graph_demo VALGRIND TESTSn" for i in $all_tests; do printf "TEST %2d %-18s : " "$i" "${tnames[i]}" # Run the test # generate the input file printf "%sn" "${input[i]}" | ./save_deltas "${format[i]}" $INPUT > /dev/null # run code through valgrind { $VALGRIND ./print_graph_demo ; } >& $VALGOUT # Check various outputs from valgrind if ! grep -q 'ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)' $VALGOUT || ! grep -q 'in use at exit: 0 bytes in 0 blocks' $VALGOUT || grep -q 'definitely lost: 0 bytes in 0 blocks' $VALGOUT; then printf "FAIL: Valgrind detected problemsn" minor_sep cat $VALGOUT minor_sep else printf "Valgrind OKn"
  • 33. ((NVALG++)) fi done printf "Finishedn" major_sep printf "%2d / %2d Valgrind correctn" "$((NVALG*valg_mult))" "$((VTESTS*valg_mult))" printf "n" fi NPASS=$((NPASS*norm_mult)) NTESTS=$((NTESTS*norm_mult)) NVALG=$((NVALG*valg_mult)) VTESTS=$((VTESTS*valg_mult)) major_sep printf "OVERALL:n" printf "%2d / %2d Normal correctn" "$NPASS" "$NTESTS" printf "%2d / %2d Valgrind correctn" "$NVALG" "$VTESTS" printf "RESULTS: %d / %d points for normal/valgrind testsn" "$((NPASS+NVALG))" "$((NTESTS+VTESTS))" __MACOSX/a1-code/._test_print_graph.sh a1-code/hashmap.h // hashmap.h: header for hashmap problem #ifndef HASHMAP_H #define HASHMAP_H 1 // Type for linked list nodes in hash map typedef struct hashnode { char key[128]; // string key for items in the map
  • 34. char val[128]; // string value for items in the map struct hashnode *next; // pointer to next node, NULL if last node } hashnode_t; // Type of hash table typedef struct { int item_count; // how many key/val pairs in the table int table_size; // how big is the table array hashnode_t **table; // array of pointers to nodes which contain key/val pairs } hashmap_t; #define HASHMAP_DEFAULT_TABLE_SIZE 5 // default size of table for main application // functions defined in hash_funcs.c long hashcode(char key[]); int next_prime(int num); void hashmap_init(hashmap_t *hm, int table_size); int hashmap_put(hashmap_t *hm, char key[], char value[]); void hashmap_expand(hashmap_t *hm); char *hashmap_get(hashmap_t *hm, char key[]); void hashmap_free_table(hashmap_t *hm); void hashmap_write_items(hashmap_t *hm, FILE *out); void hashmap_show_structure(hashmap_t *hm); void hashmap_save(hashmap_t *hm, char *filename); int hashmap_load(hashmap_t *hm, char *filename); #endif __MACOSX/a1-code/._hashmap.h
  • 35. a1-code/deltas_main.o a1-code/save_deltas a1-code/print_graph.c void print_graph(int *data, int len, int max_height){ int i,j,min_element,max_element,range; double units_per_height, val; min_element = data[0]; max_element = data[0]; for(i = 1; i < len; i++){ if(min_element > data[i]) min_element = data[i]; if(max_element < data[i]) max_element = data[i]; } range = max_element - min_element; units_per_height = (double)range / max_height; printf("length: %dn", len); printf("min: %dn", min_element); printf("max: %dn", max_element); printf("range: %dn", range); printf("max_height: %dn", max_height); printf("units_per_height: %.2lfn", units_per_height); printf("nn%6c"); for(i = 0; i < len; i++){ if(i%5 == 0) printf("+"); else printf("-"); }
  • 36. printf("n"); for(val = max_element; val >= 0; val -= units_per_height){ printf("%4d |" , (int)val); for(j = 0; j < len; j++){ if(data[j] >= val) printf("X"); else printf(" "); } printf("n"); } printf("%6c"); for(i = 0; i < len; i++){ if(i%5 == 0) printf("+"); else printf("-"); } printf("n%6c"); for(i = 0; i < len; i+=5){ printf("%-5d", i); } printf("n"); } __MACOSX/a1-code/._print_graph.c a1-code/test_hash_main_data.sh #!/bin/bash T=0 # global test number
  • 37. ((T++)) tnames[T]="start-print-quit" read -r -d '' input[$T] <<"ENDIN" print quit ENDIN # read -r -d '' output[$T] <<"ENDOUT" Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its load factor quit : exit the program HM> print HM> quit ENDOUT ((T++))
  • 38. tnames[T]="hashcode-get-empty" read -r -d '' input[$T] <<"ENDIN" print hashcode a hashcode A hashcode Aa hashcode apple hashcode banana get a get Aa get apple get banana quit ENDIN # read -r -d '' output[$T] <<"ENDOUT" Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its
  • 39. load factor quit : exit the program HM> print HM> hashcode a 97 HM> hashcode A 65 HM> hashcode Aa 24897 HM> hashcode apple 1819308129 HM> hashcode banana 1634623842 HM> get a NOT FOUND HM> get Aa NOT FOUND HM> get apple NOT FOUND HM> get banana NOT FOUND HM> quit ENDOUT ((T++)) tnames[T]="get-single" read -r -d '' input[$T] <<"ENDIN" print put apple fruit get apple get banana quit ENDIN # read -r -d '' output[$T] <<"ENDOUT"
  • 40. Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its load factor quit : exit the program HM> print HM> put apple fruit HM> get apple FOUND: fruit HM> get banana NOT FOUND HM> quit ENDOUT ((T++)) tnames[T]="put3" read -r -d '' input[$T] <<"ENDIN" put Kyle alive put Kenny dead
  • 41. put Stan alive print get Kyle get Kenny get Stan get Cartman get Token quit ENDIN # read -r -d '' output[$T] <<"ENDOUT" Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its load factor quit : exit the program HM> put Kyle alive HM> put Kenny dead HM> put Stan alive
  • 42. HM> print Kyle : alive Stan : alive Kenny : dead HM> get Kyle FOUND: alive HM> get Kenny FOUND: dead HM> get Stan FOUND: alive HM> get Cartman NOT FOUND HM> get Token NOT FOUND HM> quit ENDOUT ((T++)) tnames[T]="put-collisions" read -r -d '' input[$T] <<"ENDIN" put B 1 put D 2 put N 3 print get B get D get N get C get I put A 4 put C 5 put I 6 put X 7 put W 8 print get A
  • 43. get B get C get D get E get I get X get W get Z quit ENDIN # read -r -d '' output[$T] <<"ENDOUT" Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its load factor quit : exit the program HM> put B 1 HM> put D 2
  • 44. HM> put N 3 HM> print B : 1 D : 2 N : 3 HM> get B FOUND: 1 HM> get D FOUND: 2 HM> get N FOUND: 3 HM> get C NOT FOUND HM> get I NOT FOUND HM> put A 4 HM> put C 5 HM> put I 6 HM> put X 7 HM> put W 8 HM> print A : 4 B : 1 C : 5 W : 8 D : 2 N : 3 I : 6 X : 7 HM> get A FOUND: 4 HM> get B FOUND: 1 HM> get C FOUND: 5 HM> get D
  • 45. FOUND: 2 HM> get E NOT FOUND HM> get I FOUND: 6 HM> get X FOUND: 7 HM> get W FOUND: 8 HM> get Z NOT FOUND HM> quit ENDOUT ((T++)) tnames[T]="put3-structure" read -r -d '' input[$T] <<"ENDIN" put B 1 put D 2 put N 3 print get B get D get N get C get I structure quit ENDIN # read -r -d '' output[$T] <<"ENDOUT" Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map,
  • 46. overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its load factor quit : exit the program HM> put B 1 HM> put D 2 HM> put N 3 HM> print B : 1 D : 2 N : 3 HM> get B FOUND: 1 HM> get D FOUND: 2 HM> get N FOUND: 3 HM> get C NOT FOUND HM> get I NOT FOUND HM> structure item_count: 3
  • 47. table_size: 5 load_factor: 0.6000 0 : 1 : {(66) B : 1} 2 : 3 : {(68) D : 2} {(78) N : 3} 4 : HM> quit ENDOUT ((T++)) tnames[T]="put-overwrite" read -r -d '' input[$T] <<"ENDIN" put B 1 put D 2 put N 3 put A 4 put C 5 put I 6 put X 7 put W 8 structure put B 11 put I 66 put A 44 put W 88 structure get B get D get I get W get X quit ENDIN # read -r -d '' output[$T] <<"ENDOUT"
  • 48. Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its load factor quit : exit the program HM> put B 1 HM> put D 2 HM> put N 3 HM> put A 4 HM> put C 5 HM> put I 6 HM> put X 7 HM> put W 8 HM> structure item_count: 8 table_size: 5 load_factor: 1.6000 0 : {(65) A : 4} 1 : {(66) B : 1}
  • 49. 2 : {(67) C : 5} {(87) W : 8} 3 : {(68) D : 2} {(78) N : 3} {(73) I : 6} {(88) X : 7} 4 : HM> put B 11 Overwriting previous key/val HM> put I 66 Overwriting previous key/val HM> put A 44 Overwriting previous key/val HM> put W 88 Overwriting previous key/val HM> structure item_count: 8 table_size: 5 load_factor: 1.6000 0 : {(65) A : 44} 1 : {(66) B : 11} 2 : {(67) C : 5} {(87) W : 88} 3 : {(68) D : 2} {(78) N : 3} {(73) I : 66} {(88) X : 7} 4 : HM> get B FOUND: 11 HM> get D FOUND: 2 HM> get I FOUND: 66 HM> get W FOUND: 88 HM> get X FOUND: 7 HM> quit ENDOUT ((T++)) tnames[T]="larger-structure" read -r -d '' input[$T] <<"ENDIN"
  • 50. put Kyle alive put Kenny dead put Stan alive print structure put Cartman jerk put Timmy TIMMY! put MrGarrison odd put MrHat very-odd put Butters lovable put Chef disavowed print structure quit ENDIN # read -r -d '' output[$T] <<"ENDOUT" Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it
  • 51. expand : expands memory size of hashmap to reduce its load factor quit : exit the program HM> put Kyle alive HM> put Kenny dead HM> put Stan alive HM> print Kyle : alive Stan : alive Kenny : dead HM> structure item_count: 3 table_size: 5 load_factor: 0.6000 0 : {(1701607755) Kyle : alive} 1 : {(1851880531) Stan : alive} 2 : {(521543771467) Kenny : dead} 3 : 4 : HM> put Cartman jerk HM> put Timmy TIMMY! HM> put MrGarrison odd HM> put MrHat very-odd HM> put Butters lovable HM> put Chef disavowed HM> print Kyle : alive Cartman : jerk Butters : lovable Stan : alive MrHat : very-odd Kenny : dead MrGarrison : odd Timmy : TIMMY! Chef : disavowed HM> structure
  • 52. item_count: 9 table_size: 5 load_factor: 1.8000 0 : {(1701607755) Kyle : alive} {(31069370171154755) Cartman : jerk} {(32495402392778050) Butters : lovable} 1 : {(1851880531) Stan : alive} {(499848344141) MrHat : very-odd} 2 : {(521543771467) Kenny : dead} {(8316304022500241997) MrGarrison : odd} 3 : {(521526929748) Timmy : TIMMY!} 4 : {(1717921859) Chef : disavowed} HM> quit ENDOUT ((T++)) tnames[T]="put3-EOF" read -r -d '' input[$T] <<"ENDIN" put Kyle alive put Kenny dead put Stan alive print get Kyle ENDIN # read -r -d '' output[$T] <<"ENDOUT" Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map
  • 53. clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its load factor quit : exit the program HM> put Kyle alive HM> put Kenny dead HM> put Stan alive HM> print Kyle : alive Stan : alive Kenny : dead HM> get Kyle FOUND: alive HM> ENDOUT ((T++)) tnames[T]="clear-put-clear" read -r -d '' input[$T] <<"ENDIN" clear print structure put Kyle alive put Kenny dead put Stan alive put Cartman jerk print structure clear
  • 54. print structure put Timmy TIMMY! put MrGarrison odd put MrHat very-odd put Butters lovable put Chef disavowed print structure clear print structure ENDIN # read -r -d '' output[$T] <<"ENDOUT" Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its load factor
  • 55. quit : exit the program HM> clear HM> print HM> structure item_count: 0 table_size: 5 load_factor: 0.0000 0 : 1 : 2 : 3 : 4 : HM> put Kyle alive HM> put Kenny dead HM> put Stan alive HM> put Cartman jerk HM> print Kyle : alive Cartman : jerk Stan : alive Kenny : dead HM> structure item_count: 4 table_size: 5 load_factor: 0.8000 0 : {(1701607755) Kyle : alive} {(31069370171154755) Cartman : jerk} 1 : {(1851880531) Stan : alive} 2 : {(521543771467) Kenny : dead} 3 : 4 : HM> clear HM> print HM> structure item_count: 0 table_size: 5
  • 56. load_factor: 0.0000 0 : 1 : 2 : 3 : 4 : HM> put Timmy TIMMY! HM> put MrGarrison odd HM> put MrHat very-odd HM> put Butters lovable HM> put Chef disavowed HM> print Butters : lovable MrHat : very-odd MrGarrison : odd Timmy : TIMMY! Chef : disavowed HM> structure item_count: 5 table_size: 5 load_factor: 1.0000 0 : {(32495402392778050) Butters : lovable} 1 : {(499848344141) MrHat : very-odd} 2 : {(8316304022500241997) MrGarrison : odd} 3 : {(521526929748) Timmy : TIMMY!} 4 : {(1717921859) Chef : disavowed} HM> clear HM> print HM> structure item_count: 0 table_size: 5 load_factor: 0.0000 0 : 1 : 2 : 3 :
  • 57. 4 : HM> ENDOUT ((T++)) tnames[T]="put3-save" read -r -d '' input[$T] <<"ENDIN" put A 1 put E 2 put C 3 put D 4 save test-data/put3.tmp quit ENDIN # read -r -d '' output[$T] <<"ENDOUT" Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its
  • 58. load factor quit : exit the program HM> put A 1 HM> put E 2 HM> put C 3 HM> put D 4 HM> save test-data/put3.tmp HM> quit ENDOUT # tfiles[T]="test-data/put3.tmp" read -r -d '' tfiles_expect[$T] <<"ENDOUT" 5 4 A : 1 C : 3 D : 4 E : 2 ENDOUT ((T++)) tnames[T]="put-many-save" read -r -d '' input[$T] <<"ENDIN" put Kyle alive put Kenny dead put Stan alive put Cartman jerk put Timmy TIMMY! put MrGarrison odd put MrHat very-odd put Butters lovable put Chef disavowed print structure save test-data/put-many.tmp ENDIN #
  • 59. read -r -d '' output[$T] <<"ENDOUT" Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its load factor quit : exit the program HM> put Kyle alive HM> put Kenny dead HM> put Stan alive HM> put Cartman jerk HM> put Timmy TIMMY! HM> put MrGarrison odd HM> put MrHat very-odd HM> put Butters lovable HM> put Chef disavowed HM> print Kyle : alive Cartman : jerk Butters : lovable
  • 60. Stan : alive MrHat : very-odd Kenny : dead MrGarrison : odd Timmy : TIMMY! Chef : disavowed HM> structure item_count: 9 table_size: 5 load_factor: 1.8000 0 : {(1701607755) Kyle : alive} {(31069370171154755) Cartman : jerk} {(32495402392778050) Butters : lovable} 1 : {(1851880531) Stan : alive} {(499848344141) MrHat : very-odd} 2 : {(521543771467) Kenny : dead} {(8316304022500241997) MrGarrison : odd} 3 : {(521526929748) Timmy : TIMMY!} 4 : {(1717921859) Chef : disavowed} HM> save test-data/put-many.tmp HM> ENDOUT # tfiles[T]="test-data/put-many.tmp" read -r -d '' tfiles_expect[$T] <<"ENDOUT" 5 9 Kyle : alive Cartman : jerk Butters : lovable Stan : alive MrHat : very-odd Kenny : dead MrGarrison : odd Timmy : TIMMY! Chef : disavowed ENDOUT
  • 61. ((T++)) tnames[T]="save-load" read -r -d '' input[$T] <<"ENDIN" put A 1 put E 2 put C 3 put D 4 save test-data/save-load.tmp clear print load test-data/save-load.tmp print structure get E get R get A put R 5 put S 6 print structure get R get S load test-data/save-load.tmp print structure get R get S load test-data/not-there.tmp print quit ENDIN # read -r -d '' output[$T] <<"ENDOUT" Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map)
  • 62. put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its load factor quit : exit the program HM> put A 1 HM> put E 2 HM> put C 3 HM> put D 4 HM> save test-data/save-load.tmp HM> clear HM> print HM> load test-data/save-load.tmp HM> print A : 1 C : 3 D : 4 E : 2 HM> structure item_count: 4 table_size: 5 load_factor: 0.8000 0 : {(65) A : 1}
  • 63. 1 : 2 : {(67) C : 3} 3 : {(68) D : 4} 4 : {(69) E : 2} HM> get E FOUND: 2 HM> get R NOT FOUND HM> get A FOUND: 1 HM> put R 5 HM> put S 6 HM> print A : 1 C : 3 R : 5 D : 4 S : 6 E : 2 HM> structure item_count: 6 table_size: 5 load_factor: 1.2000 0 : {(65) A : 1} 1 : 2 : {(67) C : 3} {(82) R : 5} 3 : {(68) D : 4} {(83) S : 6} 4 : {(69) E : 2} HM> get R FOUND: 5 HM> get S FOUND: 6 HM> load test-data/save-load.tmp HM> print A : 1 C : 3
  • 64. D : 4 E : 2 HM> structure item_count: 4 table_size: 5 load_factor: 0.8000 0 : {(65) A : 1} 1 : 2 : {(67) C : 3} 3 : {(68) D : 4} 4 : {(69) E : 2} HM> get R NOT FOUND HM> get S NOT FOUND HM> load test-data/not-there.tmp ERROR: could not open file 'test-data/not-there.tmp' load failed HM> print A : 1 C : 3 D : 4 E : 2 HM> quit ENDOUT # tfiles[T]="test-data/save-load.tmp" read -r -d '' tfiles_expect[$T] <<"ENDOUT" 5 4 A : 1 C : 3 D : 4 E : 2 ENDOUT
  • 65. ((T++)) tnames[T]="prime-expand" read -r -d '' input[$T] <<"ENDIN" next_prime 5 next_prime 6 next_prime 10 next_prime 25 next_prime 1024 put A 1 put B 2 put C 3 put D 4 put E 5 put F 6 put G 7 print structure expand print structure expand print structure clear put Kyle alive put Kenny dead put Stan alive put Cartman jerk put Timmy TIMMY! put MrGarrison odd put MrHat very-odd put Butters lovable put Chef disavowed print structure expand
  • 66. print structure put Token dude put Wendy gal put Jimmy crutches put Damien evil put Santa bad put Jesus good put Marvin starvin print structure expand print structure expand print structure ENDIN # read -r -d '' output[$T] <<"ENDOUT" Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one
  • 67. in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its load factor quit : exit the program HM> next_prime 5 5 HM> next_prime 6 7 HM> next_prime 10 11 HM> next_prime 25 29 HM> next_prime 1024 1031 HM> put A 1 HM> put B 2 HM> put C 3 HM> put D 4 HM> put E 5 HM> put F 6 HM> put G 7 HM> print A : 1 F : 6 B : 2 G : 7 C : 3 D : 4 E : 5 HM> structure item_count: 7 table_size: 5 load_factor: 1.4000 0 : {(65) A : 1} {(70) F : 6}
  • 68. 1 : {(66) B : 2} {(71) G : 7} 2 : {(67) C : 3} 3 : {(68) D : 4} 4 : {(69) E : 5} HM> expand HM> print B : 2 C : 3 D : 4 E : 5 F : 6 G : 7 A : 1 HM> structure item_count: 7 table_size: 11 load_factor: 0.6364 0 : {(66) B : 2} 1 : {(67) C : 3} 2 : {(68) D : 4} 3 : {(69) E : 5} 4 : {(70) F : 6} 5 : {(71) G : 7} 6 : 7 : 8 : 9 : 10 : {(65) A : 1} HM> expand HM> print E : 5 F : 6 G : 7 A : 1 B : 2 C : 3
  • 69. D : 4 HM> structure item_count: 7 table_size: 23 load_factor: 0.3043 0 : {(69) E : 5} 1 : {(70) F : 6} 2 : {(71) G : 7} 3 : 4 : 5 : 6 : 7 : 8 : 9 : 10 : 11 : 12 : 13 : 14 : 15 : 16 : 17 : 18 : 19 : {(65) A : 1} 20 : {(66) B : 2} 21 : {(67) C : 3} 22 : {(68) D : 4} HM> clear HM> put Kyle alive HM> put Kenny dead HM> put Stan alive HM> put Cartman jerk HM> put Timmy TIMMY! HM> put MrGarrison odd HM> put MrHat very-odd
  • 70. HM> put Butters lovable HM> put Chef disavowed HM> print Kyle : alive Cartman : jerk Butters : lovable Stan : alive MrHat : very-odd Kenny : dead MrGarrison : odd Timmy : TIMMY! Chef : disavowed HM> structure item_count: 9 table_size: 5 load_factor: 1.8000 0 : {(1701607755) Kyle : alive} {(31069370171154755) Cartman : jerk} {(32495402392778050) Butters : lovable} 1 : {(1851880531) Stan : alive} {(499848344141) MrHat : very-odd} 2 : {(521543771467) Kenny : dead} {(8316304022500241997) MrGarrison : odd} 3 : {(521526929748) Timmy : TIMMY!} 4 : {(1717921859) Chef : disavowed} HM> expand HM> print Cartman : jerk Butters : lovable Timmy : TIMMY! Kyle : alive MrHat : very-odd Kenny : dead Chef : disavowed Stan : alive MrGarrison : odd HM> structure
  • 71. item_count: 9 table_size: 11 load_factor: 0.8182 0 : {(31069370171154755) Cartman : jerk} {(32495402392778050) Butters : lovable} {(521526929748) Timmy : TIMMY!} 1 : {(1701607755) Kyle : alive} 2 : 3 : {(499848344141) MrHat : very-odd} 4 : {(521543771467) Kenny : dead} 5 : {(1717921859) Chef : disavowed} 6 : {(1851880531) Stan : alive} 7 : 8 : 9 : {(8316304022500241997) MrGarrison : odd} 10 : HM> put Token dude HM> put Wendy gal HM> put Jimmy crutches HM> put Damien evil HM> put Santa bad HM> put Jesus good HM> put Marvin starvin HM> print Cartman : jerk Butters : lovable Timmy : TIMMY! Santa : bad Kyle : alive Jimmy : crutches MrHat : very-odd Damien : evil Kenny : dead Token : dude Jesus : good Chef : disavowed
  • 72. Stan : alive Marvin : starvin MrGarrison : odd Wendy : gal HM> structure item_count: 16 table_size: 11 load_factor: 1.4545 0 : {(31069370171154755) Cartman : jerk} {(32495402392778050) Butters : lovable} {(521526929748) Timmy : TIMMY!} {(418565218643) Santa : bad} 1 : {(1701607755) Kyle : alive} {(521526929738) Jimmy : crutches} 2 : 3 : {(499848344141) MrHat : very-odd} {(121381839528260) Damien : evil} 4 : {(521543771467) Kenny : dead} {(474147942228) Token : dude} {(495891735882) Jesus : good} 5 : {(1717921859) Chef : disavowed} 6 : {(1851880531) Stan : alive} {(121399237828941) Marvin : starvin} 7 : 8 : 9 : {(8316304022500241997) MrGarrison : odd} 10 : {(521375999319) Wendy : gal} HM> expand HM> print Timmy : TIMMY! Santa : bad Marvin : starvin Damien : evil Wendy : gal Cartman : jerk Jimmy : crutches Kenny : dead Jesus : good
  • 73. Chef : disavowed MrHat : very-odd Butters : lovable Stan : alive MrGarrison : odd Kyle : alive Token : dude HM> structure item_count: 16 table_size: 23 load_factor: 0.6957 0 : 1 : 2 : {(521526929748) Timmy : TIMMY!} {(418565218643) Santa : bad} {(121399237828941) Marvin : starvin} 3 : 4 : 5 : 6 : 7 : 8 : 9 : {(121381839528260) Damien : evil} 10 : 11 : 12 : {(521375999319) Wendy : gal} 13 : {(31069370171154755) Cartman : jerk} 14 : 15 : {(521526929738) Jimmy : crutches} 16 : 17 : {(521543771467) Kenny : dead} {(495891735882) Jesus : good} {(1717921859) Chef : disavowed} 18 : {(499848344141) MrHat : very-odd} 19 : {(32495402392778050) Butters : lovable} {(1851880531) Stan : alive} {(8316304022500241997) MrGarrison : odd} 20 : {(1701607755) Kyle : alive} 21 :
  • 74. 22 : {(474147942228) Token : dude} HM> expand HM> print Jimmy : crutches Timmy : TIMMY! Kyle : alive Butters : lovable Cartman : jerk Stan : alive Wendy : gal Jesus : good Damien : evil MrGarrison : odd Kenny : dead Marvin : starvin Santa : bad Chef : disavowed MrHat : very-odd Token : dude HM> structure item_count: 16 table_size: 47 load_factor: 0.3404 0 : {(521526929738) Jimmy : crutches} 1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : 9 : 10 : {(521526929748) Timmy : TIMMY!} 11 : 12 :
  • 75. 13 : 14 : 15 : {(1701607755) Kyle : alive} 16 : 17 : 18 : 19 : {(32495402392778050) Butters : lovable} 20 : {(31069370171154755) Cartman : jerk} {(1851880531) Stan : alive} 21 : 22 : 23 : {(521375999319) Wendy : gal} {(495891735882) Jesus : good} 24 : {(121381839528260) Damien : evil} 25 : 26 : {(8316304022500241997) MrGarrison : odd} 27 : 28 : 29 : 30 : 31 : {(521543771467) Kenny : dead} 32 : 33 : 34 : 35 : {(121399237828941) Marvin : starvin} 36 : 37 : 38 : 39 : 40 : {(418565218643) Santa : bad} 41 : 42 : 43 : {(1717921859) Chef : disavowed} 44 : {(499848344141) MrHat : very-odd} 45 : {(474147942228) Token : dude} 46 :
  • 76. HM> ENDOUT ((T++)) tnames[T]="stress" read -r -d '' input[$T] <<"ENDIN" put Kyle alive put Kenny dead put Stan alive put Cartman jerk put Timmy TIMMY! put MrGarrison odd put MrHat very-odd put Butters lovable put Chef disavowed structure expand structure save test-data/stress1.tmp put Token dude put Wendy gal put Jimmy crutches put Damien evil put Santa bad put Jesus good put Marvin starvin put Kenny ALIVE put MrHat MrStick structure expand expand structure save test-data/stress2.tmp load test-data/stress1.tmp structure
  • 77. get Santa get Marvin get Cartman get MrHat put Syndney Portier put Robert Smith expand expand expand structure get Cartman get Robert save test-data/stress3.tmp load test-data/stress2.tmp print structure get MrGarrison get MrHat get Kenny get Santa get Wendy get Marvin get Sydney put Kenny dead load test-data/stress3.tmp get Kenny structure expand structure quit ENDIN # read -r -d '' output[$T] <<"ENDOUT" Hashmap Demo Commands: hashcode <key> : prints out the numeric hash code for the
  • 78. given key (does not change the hash map) put <key> <val> : inserts the given key/val into the hash map, overwrites existing values if present get <key> : prints the value associated with the given key or NOT FOUND print : shows contents of the hashmap ordered by how they appear in the table structure : prints detailed structure of the hash map clear : reinitializes hash map to be empty with default size save <file> : writes the contents of the hash map the given file load <file> : clears the current hash map and loads the one in the given file next_prime <int> : if <int> is prime, prints it, otherwise finds the next prime and prints it expand : expands memory size of hashmap to reduce its load factor quit : exit the program HM> put Kyle alive HM> put Kenny dead HM> put Stan alive HM> put Cartman jerk HM> put Timmy TIMMY! HM> put MrGarrison odd HM> put MrHat very-odd HM> put Butters lovable HM> put Chef disavowed HM> structure item_count: 9 table_size: 5 load_factor: 1.8000 0 : {(1701607755) Kyle : alive} {(31069370171154755) Cartman : jerk} {(32495402392778050) Butters : lovable} 1 : {(1851880531) Stan : alive} {(499848344141) MrHat : very-odd}
  • 79. 2 : {(521543771467) Kenny : dead} {(8316304022500241997) MrGarrison : odd} 3 : {(521526929748) Timmy : TIMMY!} 4 : {(1717921859) Chef : disavowed} HM> expand HM> structure item_count: 9 table_size: 11 load_factor: 0.8182 0 : {(31069370171154755) Cartman : jerk} {(32495402392778050) Butters : lovable} {(521526929748) Timmy : TIMMY!} 1 : {(1701607755) Kyle : alive} 2 : 3 : {(499848344141) MrHat : very-odd} 4 : {(521543771467) Kenny : dead} 5 : {(1717921859) Chef : disavowed} 6 : {(1851880531) Stan : alive} 7 : 8 : 9 : {(8316304022500241997) MrGarrison : odd} 10 : HM> save test-data/stress1.tmp HM> put Token dude HM> put Wendy gal HM> put Jimmy crutches HM> put Damien evil HM> put Santa bad HM> put Jesus good HM> put Marvin starvin HM> put Kenny ALIVE Overwriting previous key/val HM> put MrHat MrStick Overwriting previous key/val HM> structure item_count: 16
  • 80. table_size: 11 load_factor: 1.4545 0 : {(31069370171154755) Cartman : jerk} {(32495402392778050) Butters : lovable} {(521526929748) Timmy : TIMMY!} {(418565218643) Santa : bad} 1 : {(1701607755) Kyle : alive} {(521526929738) Jimmy : crutches} 2 : 3 : {(499848344141) MrHat : MrStick} {(121381839528260) Damien : evil} 4 : {(521543771467) Kenny : ALIVE} {(474147942228) Token : dude} {(495891735882) Jesus : good} 5 : {(1717921859) Chef : disavowed} 6 : {(1851880531) Stan : alive} {(121399237828941) Marvin : starvin} 7 : 8 : 9 : {(8316304022500241997) MrGarrison : odd} 10 : {(521375999319) Wendy : gal} HM> expand HM> expand HM> structure item_count: 16 table_size: 47 load_factor: 0.3404 0 : {(521526929738) Jimmy : crutches} 1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : 9 : 10 : {(521526929748) Timmy : TIMMY!}
  • 81. 11 : 12 : 13 : 14 : 15 : {(1701607755) Kyle : alive} 16 : 17 : 18 : 19 : {(32495402392778050) Butters : lovable} 20 : {(31069370171154755) Cartman : jerk} {(1851880531) Stan : alive} 21 : 22 : 23 : {(521375999319) Wendy : gal} {(495891735882) Jesus : good} 24 : {(121381839528260) Damien : evil} 25 : 26 : {(8316304022500241997) MrGarrison : odd} 27 : 28 : 29 : 30 : 31 : {(521543771467) Kenny : ALIVE} 32 : 33 : 34 : 35 : {(121399237828941) Marvin : starvin} 36 : 37 : 38 : 39 : 40 : {(418565218643) Santa : bad} 41 : 42 : 43 : {(1717921859) Chef : disavowed} 44 : {(499848344141) MrHat : MrStick}
  • 82. 45 : {(474147942228) Token : dude} 46 : HM> save test-data/stress2.tmp HM> load test-data/stress1.tmp HM> structure item_count: 9 table_size: 11 load_factor: 0.8182 0 : {(31069370171154755) Cartman : jerk} {(32495402392778050) Butters : lovable} {(521526929748) Timmy : TIMMY!} 1 : {(1701607755) Kyle : alive} 2 : 3 : {(499848344141) MrHat : very-odd} 4 : {(521543771467) Kenny : dead} 5 : {(1717921859) Chef : disavowed} 6 : {(1851880531) Stan : alive} 7 : 8 : 9 : {(8316304022500241997) MrGarrison : odd} 10 : HM> get Santa NOT FOUND HM> get Marvin NOT FOUND HM> get Cartman FOUND: jerk HM> get MrHat FOUND: very-odd HM> put Syndney Portier HM> put Robert Smith HM> expand HM> expand HM> expand HM> structure item_count: 11
  • 83. table_size: 97 load_factor: 0.1134 0 : 1 : 2 : 3 : {(521543771467) Kenny : dead} 4 : 5 : 6 : {(521526929748) Timmy : TIMMY!} 7 : 8 : 9 : 10 : 11 : 12 : 13 : 14 : 15 : {(32495402392778050) Butters : lovable} 16 : 17 : 18 : 19 : 20 : 21 : 22 : 23 : 24 : 25 : 26 : 27 : 28 : 29 : 30 : 31 : 32 : 33 : {(8316304022500241997) MrGarrison : odd}
  • 84. 34 : 35 : 36 : 37 : 38 : 39 : 40 : 41 : 42 : 43 : 44 : 45 : 46 : 47 : 48 : 49 : 50 : 51 : 52 : 53 : 54 : 55 : {(128034676043602) Robert : Smith} 56 : 57 : 58 : 59 : 60 : 61 : {(1717921859) Chef : disavowed} 62 : 63 : {(31069370171154755) Cartman : jerk} 64 : 65 : 66 : 67 : 68 : 69 :
  • 85. 70 : 71 : 72 : 73 : 74 : {(34169996987758931) Syndney : Portier} 75 : 76 : 77 : {(499848344141) MrHat : very-odd} 78 : 79 : 80 : 81 : 82 : 83 : 84 : {(1851880531) Stan : alive} 85 : 86 : 87 : 88 : 89 : 90 : 91 : 92 : 93 : 94 : 95 : 96 : {(1701607755) Kyle : alive} HM> get Cartman FOUND: jerk HM> get Robert FOUND: Smith HM> save test-data/stress3.tmp HM> load test-data/stress2.tmp HM> print Jimmy : crutches Timmy : TIMMY!
  • 86. Kyle : alive Butters : lovable Cartman : jerk Stan : alive Wendy : gal Jesus : good Damien : evil MrGarrison : odd Kenny : ALIVE Marvin : starvin Santa : bad Chef : disavowed MrHat : MrStick Token : dude HM> structure item_count: 16 table_size: 47 load_factor: 0.3404 0 : {(521526929738) Jimmy : crutches} 1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : 9 : 10 : {(521526929748) Timmy : TIMMY!} 11 : 12 : 13 : 14 : 15 : {(1701607755) Kyle : alive} 16 : 17 :
  • 87. 18 : 19 : {(32495402392778050) Butters : lovable} 20 : {(31069370171154755) Cartman : jerk} {(1851880531) Stan : alive} 21 : 22 : 23 : {(521375999319) Wendy : gal} {(495891735882) Jesus : good} 24 : {(121381839528260) Damien : evil} 25 : 26 : {(8316304022500241997) MrGarrison : odd} 27 : 28 : 29 : 30 : 31 : {(521543771467) Kenny : ALIVE} 32 : 33 : 34 : 35 : {(121399237828941) Marvin : starvin} 36 : 37 : 38 : 39 : 40 : {(418565218643) Santa : bad} 41 : 42 : 43 : {(1717921859) Chef : disavowed} 44 : {(499848344141) MrHat : MrStick} 45 : {(474147942228) Token : dude} 46 : HM> get MrGarrison FOUND: odd HM> get MrHat FOUND: MrStick HM> get Kenny
  • 88. FOUND: ALIVE HM> get Santa FOUND: bad HM> get Wendy FOUND: gal HM> get Marvin FOUND: starvin HM> get Sydney NOT FOUND HM> put Kenny dead Overwriting previous key/val HM> load test-data/stress3.tmp HM> get Kenny FOUND: dead HM> structure item_count: 11 table_size: 97 load_factor: 0.1134 0 : 1 : 2 : 3 : {(521543771467) Kenny : dead} 4 : 5 : 6 : {(521526929748) Timmy : TIMMY!} 7 : 8 : 9 : 10 : 11 : 12 : 13 : 14 : 15 : {(32495402392778050) Butters : lovable} 16 : 17 :
  • 89. 18 : 19 : 20 : 21 : 22 : 23 : 24 : 25 : 26 : 27 : 28 : 29 : 30 : 31 : 32 : 33 : {(8316304022500241997) MrGarrison : odd} 34 : 35 : 36 : 37 : 38 : 39 : 40 : 41 : 42 : 43 : 44 : 45 : 46 : 47 : 48 : 49 : 50 : 51 : 52 : 53 :
  • 90. 54 : 55 : {(128034676043602) Robert : Smith} 56 : 57 : 58 : 59 : 60 : 61 : {(1717921859) Chef : disavowed} 62 : 63 : {(31069370171154755) Cartman : jerk} 64 : 65 : 66 : 67 : 68 : 69 : 70 : 71 : 72 : 73 : 74 : {(34169996987758931) Syndney : Portier} 75 : 76 : 77 : {(499848344141) MrHat : very-odd} 78 : 79 : 80 : 81 : 82 : 83 : 84 : {(1851880531) Stan : alive} 85 : 86 : 87 : 88 : 89 :
  • 91. 90 : 91 : 92 : 93 : 94 : 95 : 96 : {(1701607755) Kyle : alive} HM> expand HM> structure item_count: 11 table_size: 197 load_factor: 0.0558 0 : 1 : 2 : 3 : {(521543771467) Kenny : dead} 4 : 5 : 6 : 7 : 8 : 9 : 10 : 11 : {(521526929748) Timmy : TIMMY!} 12 : 13 : 14 : 15 : 16 : 17 : 18 : 19 : 20 : 21 : 22 : 23 :
  • 92. 24 : 25 : 26 : 27 : 28 : 29 : 30 : 31 : 32 : 33 : 34 : 35 : 36 : 37 : 38 : 39 : 40 : 41 : 42 : 43 : 44 : 45 : 46 : 47 : 48 : 49 : 50 : 51 : 52 : 53 : 54 : 55 : 56 : 57 : 58 : {(499848344141) MrHat : very-odd} 59 : {(128034676043602) Robert : Smith}
  • 93. 60 : 61 : 62 : 63 : 64 : 65 : 66 : 67 : 68 : 69 : 70 : 71 : 72 : 73 : 74 : 75 : 76 : 77 : {(34169996987758931) Syndney : Portier} 78 : 79 : 80 : 81 : 82 : {(8316304022500241997) MrGarrison : odd} 83 : 84 : 85 : 86 : 87 : 88 : 89 : 90 : 91 : 92 : {(32495402392778050) Butters : lovable} 93 : 94 : 95 :
  • 94. 96 : 97 : 98 : 99 : 100 : 101 : 102 : 103 : 104 : {(1717921859) Chef : disavowed} 105 : 106 : 107 : 108 : 109 : 110 : 111 : 112 : 113 : 114 : 115 : 116 : 117 : 118 : 119 : 120 : 121 : 122 : 123 : 124 : 125 : 126 : 127 : 128 : 129 : 130 : 131 :
  • 95. 132 : 133 : 134 : 135 : 136 : 137 : 138 : 139 : 140 : 141 : 142 : 143 : 144 : 145 : 146 : 147 : 148 : 149 : 150 : 151 : 152 : 153 : 154 : 155 : {(1851880531) Stan : alive} 156 : 157 : 158 : 159 : 160 : 161 : {(1701607755) Kyle : alive} 162 : 163 : 164 : 165 : 166 : 167 :
  • 96. 168 : {(31069370171154755) Cartman : jerk} 169 : 170 : 171 : 172 : 173 : 174 : 175 : 176 : 177 : 178 : 179 : 180 : 181 : 182 : 183 : 184 : 185 : 186 : 187 : 188 : 189 : 190 : 191 : 192 : 193 : 194 : 195 : 196 : HM> quit ENDOUT __MACOSX/a1-code/._test_hash_main_data.sh a1-code/test_read_deltas.o
  • 97. a1-code/save_deltas.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include "deltas.h" #define MODE_TEXT 1 #define MODE_INT 2 #define MODE_4BIT 3 int main(int argc, char *argv[]){ if(argc < 3){ printf("usage: %s <format> <filename>n",argv[0]); printf("reads input from stdin and outputs in given format to <filename>n"); printf("if typing numbers in, press Ctrl-D to end inputn"); printf(" <format> is one ofn"); printf(" text : text ints are in the given filenamen"); printf(" int : binary ints are in the given filenamen"); printf(" 4bit : 4bit binary ints are in the given filenamen"); return 1; } char *format = argv[1]; char *fname = argv[2]; int mode = -1; if( strcmp("text", format)==0 ){ mode = MODE_TEXT; } else if( strcmp("int", format)==0 ){ mode = MODE_INT; } else if( strcmp("4bit", format)==0 ){ mode = MODE_4BIT; } else{
  • 98. printf("Unknown format '%s'n",format); return 1; } FILE *fout = fopen(fname,"w"); int curr, prev; int result = fscanf(stdin,"%d",&curr); // handle first number if(result == EOF){ fclose(fout); printf("error: no numbers givenn"); return 1; } if(mode == MODE_TEXT){ fprintf(fout,"%d ",curr); } else if(mode == MODE_INT || mode == MODE_4BIT ){ fwrite(&curr,sizeof(int),1,fout); } int count = 1; prev=curr; while(fscanf(stdin,"%d",&curr) != EOF){ if(mode == MODE_TEXT){ int delta = curr - prev; fprintf(fout,"%d ",delta); prev = curr; count++; } else if(mode == MODE_INT){ int delta = curr - prev; fwrite(&delta,sizeof(int),1,fout); prev = curr; count++; } else if(mode == MODE_4BIT){
  • 99. int prev2 = prev; prev = curr; if(fscanf(stdin,"%d",&curr) == EOF){ printf("incorrect length of input for 4bit formatn"); fclose(fout); return 1; } int delta1 = prev - prev2; int delta2 = curr - prev; // printf("[%d]: %dn",count,delta1); // printf("[%d]: %dn",count+1,delta2); if(delta1 > 7 || delta1 < -8 || delta2 > 7 || delta2 < -8){ printf("index %d: too large for 4bit: %d %dn", count,delta1, delta2); return 1; } char byte = ((delta1 << 0 ) & 0b00001111) | ((delta2 << 4 ) & 0b11110000); fwrite(&byte, 1, 1, fout); count+=2; prev = curr; } } if(MODE_TEXT){ fprintf(fout,"n"); } fclose(fout); printf("wrote %d ints to %s in %s formatn", count, fname, format); return 0; } __MACOSX/a1-code/._save_deltas.c
  • 100. a1-code/make a1-code/read_deltas.o a1-code/graph_main.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include "deltas.h" #include <sys/types.h> #include <sys/stat.h> int main(int argc, char const *argv[]) { if(argc < 3){ printf("usage: %s <format> <filename>n",argv[0]); printf(" <format> is one ofn"); printf(" text : text ints are in the given filenamen"); printf(" int : binary ints are in the given filenamen"); printf(" 4bit : 4bit binary ints are in the given filenamen"); return 1; } char *format = argv[1]; char *fname = argv[2];
  • 101. return 0; } __MACOSX/a1-code/._graph_main.c a1-code/test_graph_file_data.sh #!/bin/bash T=0 # global test number ((T++)) tnames[T]="text-ten-5" format[T]="text" height[T]="5" read -r -d '' input[$T] <<"ENDIN" 0 1 2 3 4 5 6 7 8 9 10 ENDIN # read -r -d '' output[$T] <<"ENDOUT" Reading text format length: 11 min: 0 max: 10 range: 10 max_height: 5 units_per_height: 2.00 +----+----+ 10 | X 8 | XXX 6 | XXXXX 4 | XXXXXXX 2 | XXXXXXXXX
  • 102. 0 |XXXXXXXXXXX +----+----+ 0 5 10 ENDOUT ((T++)) tnames[T]="text-ten-20" format[T]="text" height[T]="20" read -r -d '' input[$T] <<"ENDIN" 0 1 2 3 4 5 6 7 8 9 10 ENDIN # read -r -d '' output[$T] <<"ENDOUT" Reading text format length: 11 min: 0 max: 10 range: 10 max_height: 20 units_per_height: 0.50 +----+----+ 10 | X 9 | XX 9 | XX 8 | XXX 8 | XXX 7 | XXXX 7 | XXXX 6 | XXXXX 6 | XXXXX 5 | XXXXXX 5 | XXXXXX 4 | XXXXXXX 4 | XXXXXXX 3 | XXXXXXXX
  • 103. 3 | XXXXXXXX 2 | XXXXXXXXX 2 | XXXXXXXXX 1 | XXXXXXXXXX 1 | XXXXXXXXXX 0 |XXXXXXXXXXX 0 |XXXXXXXXXXX +----+----+ 0 5 10 ENDOUT ((T++)) tnames[T]="text-21-5" format[T]="text" height[T]="5" read -r -d '' input[$T] <<"ENDIN" 20 18 14 10 7 2 3 1 5 9 5 7 7 5 5 5 7 8 3 7 4 ENDIN # read -r -d '' output[$T] <<"ENDOUT" Reading text format length: 21 min: 1 max: 20 range: 19 max_height: 5 units_per_height: 3.80 +----+----+----+----+ 20 |X 16 |XX 12 |XXX 8 |XXXX X X 4 |XXXXX XXXXXXXXXX XX 1 |XXXXXXXXXXXXXXXXXXXXX +----+----+----+----+ 0 5 10 15 20
  • 104. ENDOUT ((T++)) tnames[T]="text-21-12" format[T]="text" height[T]="12" read -r -d '' input[$T] <<"ENDIN" 20 18 14 10 7 2 3 1 5 9 5 7 7 5 5 5 7 8 3 7 4 ENDIN # read -r -d '' output[$T] <<"ENDOUT" Reading text format length: 21 min: 1 max: 20 range: 19 max_height: 12 units_per_height: 1.58 +----+----+----+----+ 20 |X 18 |XX 16 |XX 15 |XX 13 |XXX 12 |XXX 10 |XXXX 8 |XXXX X X 7 |XXXXX X XX XX X 5 |XXXXX XXXXXXXXXX X 4 |XXXXX XXXXXXXXXX XX 2 |XXXXXXX XXXXXXXXXXXXX 1 |XXXXXXXXXXXXXXXXXXXXX +----+----+----+----+ 0 5 10 15 20 ENDOUT
  • 105. ((T++)) tnames[T]="int-21-7" format[T]="int" height[T]="7" read -r -d '' input[$T] <<"ENDIN" 20 18 14 10 7 2 3 1 5 9 5 7 7 5 5 5 7 8 3 7 4 ENDIN # read -r -d '' output[$T] <<"ENDOUT" Reading binary int format length: 21 min: 1 max: 20 range: 19 max_height: 7 units_per_height: 2.71 +----+----+----+----+ 20 |X 17 |XX 14 |XXX 11 |XXX 9 |XXXX X 6 |XXXXX X XX XX X 3 |XXXXX X XXXXXXXXXXXXX 1 |XXXXXXXXXXXXXXXXXXXXX +----+----+----+----+ 0 5 10 15 20 ENDOUT ((T++)) tnames[T]="int-21-15" format[T]="int" height[T]="15" read -r -d '' input[$T] <<"ENDIN"
  • 106. 20 18 14 10 7 2 3 1 5 9 5 7 7 5 5 5 7 8 3 7 4 ENDIN # read -r -d '' output[$T] <<"ENDOUT" Reading binary int format length: 21 min: 1 max: 20 range: 19 max_height: 15 units_per_height: 1.27 +----+----+----+----+ 20 |X 18 |XX 17 |XX 16 |XX 14 |XXX 13 |XXX 12 |XXX 11 |XXX 9 |XXXX X 8 |XXXX X X 7 |XXXXX X XX XX X 6 |XXXXX X XX XX X 4 |XXXXX XXXXXXXXXX XX 3 |XXXXX X XXXXXXXXXXXXX 2 |XXXXXXX XXXXXXXXXXXXX 1 |XXXXXXXXXXXXXXXXXXXXX +----+----+----+----+ 0 5 10 15 20 ENDOUT ((T++)) tnames[T]="text-wave-8" format[T]="text" height[T]="8"
  • 107. read -r -d '' input[$T] <<"ENDIN" 0 2 4 6 8 10 11 13 14 16 17 18 19 19 20 20 20 20 19 19 18 17 16 15 14 12 10 9 7 5 3 1 -1 -3 -5 -7 -9 -11 -12 -14 -15 -16 -17 - 18 -19 -20 -20 -20 -20 -20 -19 -19 -18 -17 -15 -14 -13 -11 -9 -7 -6 -4 -2 0 2 4 6 8 10 11 13 14 16 17 18 19 19 20 20 20 20 19 19 18 17 16 15 14 12 10 9 7 5 3 1 -1 -3 -5 -7 -9 -11 -12 -14 -15 -16 -17 -18 -19 -20 -20 -20 -20 -20 -19 -19 -18 -17 -15 -14 -13 -11 - 9 -7 -6 -4 -2 0 ENDIN # read -r -d '' output[$T] <<"ENDOUT" Reading text format length: 127 min: -20 max: 20 range: 40 max_height: 8 units_per_height: 5.00 +----+----+----+----+----+----+----+----+----+----+----+----+-- --+----+----+----+----+----+----+----+----+----+----+----+----+- 20 | XXXX XXXX 15 | XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX 10 | XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX 5 | XXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX 0 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X -5 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX -10 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  • 108. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXXXXX -15 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXX -20 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXX +----+----+----+----+----+----+----+----+----+----+----+----+-- --+----+----+----+----+----+----+----+----+----+----+----+----+- 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 ENDOUT ((T++)) tnames[T]="int-wave-15" format[T]="int" height[T]="15" read -r -d '' input[$T] <<"ENDIN" 0 2 4 6 8 10 11 13 14 16 17 18 19 19 20 20 20 20 19 19 18 17 16 15 14 12 10 9 7 5 3 1 -1 -3 -5 -7 -9 -11 -12 -14 -15 -16 -17 - 18 -19 -20 -20 -20 -20 -20 -19 -19 -18 -17 -15 -14 -13 -11 -9 -7 -6 -4 -2 0 2 4 6 8 10 11 13 14 16 17 18 19 19 20 20 20 20 19 19 18 17 16 15 14 12 10 9 7 5 3 1 -1 -3 -5 -7 -9 -11 -12 -14 -15 -16 -17 -18 -19 -20 -20 -20 -20 -20 -19 -19 -18 -17 -15 -14 -13 -11 - 9 -7 -6 -4 -2 0 ENDIN # read -r -d '' output[$T] <<"ENDOUT" Reading binary int format length: 127 min: -20
  • 109. max: 20 range: 40 max_height: 15 units_per_height: 2.67 +----+----+----+----+----+----+----+----+----+----+----+----+-- --+----+----+----+----+----+----+----+----+----+----+----+----+- 20 | XXXX XXXX 17 | XXXXXXXXXXXX XXXXXXXXXXXX 14 | XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX 12 | XXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX 9 | XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX 6 | XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX 4 | XXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX 1 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -1 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X -4 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX -6 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX -9 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXXXXX -12
  • 110. |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXXXXX -14 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXX -17 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXX -20 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXX +----+----+----+----+----+----+----+----+----+----+----+----+-- --+----+----+----+----+----+----+----+----+----+----+----+----+- 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 ENDOUT ((T++)) tnames[T]="text-rand-14" format[T]="text" height[T]="14" read -r -d '' input[$T] <<"ENDIN" 18 9 84 26 41 90 60 61 78 17 71 38 24 83 18 53 85 79 21 36 16 14 52 95 21 34 11 42 95 71 49 7 58 77 62 84 24 14 47 8 87 94 96 17 55 75 89 73 79 94 76 37 59 66 86 92 15 7 75 30 67 7 5 42 55 39 2 75 81 26 14 59 48 59 89 25 96 77 35 36 46 26 8 47 7 15 47 98 75 67 90 5 83 85 43 90 40 94 43 84 38 75 22 13 37 77 83
  • 111. 13 12 9 18 67 79 39 61 83 52 72 34 63 44 5 14 51 14 49 91 24 ENDIN # read -r -d '' output[$T] <<"ENDOUT" Reading text format length: 128 min: 2 max: 98 range: 96 max_height: 14 units_per_height: 6.86 +----+----+----+----+----+----+----+----+----+----+----+----+-- --+----+----+----+----+----+----+----+----+----+----+----+----+-- 98 | X 91 | X X XX X X X X X X 84 | X X X X X X XXX X X XX X X X X X X X X X 77 | X X X X XX X X X X XXX X XX XX X X XX X X XX X X X XX X X X 70 | X X X X X XX X XX X X XXX XXXXXX XX X XX X XX XX X XX X X X X XX X X X X 63 | X X X X X XX X XX X X XXX XXXXXX XXX X X XX X XX XXXX XX X X X X XX XX X X X X 56 | X XXXX X X XX X XX XXXX XXX XXXXXX XXXX X X XX X XX XX XXXX XX X X X X XX XX XX X X X 50 | X XXXX X X XXX XX XX XXXX XXX XXXXXXX XXXX X X X XX X XX XX XXXX XX X X X X XX XX XXXX X X X 43 | X XXXX X X XXX XX XXX XXXX X XXX XXXXXXX XXXX X X X XX XXXX XX X X XXXXX XXXX XXX X XX XX XXXX XX X XX
  • 112. 36 | X XXXXX XX X XXX X XX XXXX XXXX X XXX XXXXXXXXXXXX X X XXX XX XXXX XX XX X XXXXX XXXXXXXXXX XXX XXXXXXX XX X XX 29 | X XXXXX XX X XXX X XX X XXXX XXXX X XXX XXXXXXXXXXXX XXX XXX XX XXXX XXXXX X XXXXX XXXXXXXXXX XXX XXXXXXXXXX X XX 22 | XXXXXXX XXXX XXX X XX X XXXX XXXXX X XXX XXXXXXXXXXXX XXX XXX XXX XXXXXXXXXXX X XXXXX XXXXXXXXXXX XXX XXXXXXXXXX X XXX 15 |X XXXXXXXXXXXXXXXXXXX XXXX XXXX XXXXX X XXXXXXXXXXXXXXXXX XXX XXX XXX XXXXXXXXXXX X XXXXXX XXXXXXXXXXX XXX XXXXXXXXXXX X XXX 8 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX XXXXXXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX 2 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX +----+----+----+----+----+----+----+----+----+----+----+----+-- --+----+----+----+----+----+----+----+----+----+----+----+----+-- 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 ENDOUT ((T++)) tnames[T]="int-rand-32" format[T]="text" height[T]="32" read -r -d '' input[$T] <<"ENDIN" 18 9 84 26 41 90 60 61 78 17 71 38 24 83 18 53 85 79 21 36 16 14 52 95 21 34 11 42 95 71 49 7 58 77 62 84 24 14 47 8 87 94
  • 113. 96 17 55 75 89 73 79 94 76 37 59 66 86 92 15 7 75 30 67 7 5 42 55 39 2 75 81 26 14 59 48 59 89 25 96 77 35 36 46 26 8 47 7 15 47 98 75 67 90 5 83 85 43 90 40 94 43 84 38 75 22 13 37 77 83 13 12 9 18 67 79 39 61 83 52 72 34 63 44 5 14 51 14 49 91 24 ENDIN # read -r -d '' output[$T] <<"ENDOUT" Reading text format length: 128 min: 2 max: 98 range: 96 max_height: 32 units_per_height: 3.00 +----+----+----+----+----+----+----+----+----+----+----+----+-- --+----+----+----+----+----+----+----+----+----+----+----+----+-- 98 | X 95 | X X X X X 92 | X X XX X X X X X 89 | X X X XX X X X X X X X X X X 86 | X X X XXX X X XX X X X X X X X 83 | X X X X X X X XXX X X XX X X X X XX X X X X X X 80 | X X X X X X X XXX X X XX X X X X X XX X X X X X X 77 | X X X X XX X X X X XXX X XX XX X X XX X X XX X X X XX X X X 74 | X X X X XX X X X X XXX XX XXX XX X XX X XX XX X XX X X X X XX X X X 71 | X X X X X XX X XX X X XXX XXXXXX
  • 114. XX X XX X XX XX X XX X X X X XX X X X X 68 | X X X X X XX X XX X X XXX XXXXXX XX X XX X XX XX X XX X X X X XX X X X X 65 | X X X X X XX X XX X X XXX XXXXXX XXX X X XX X XX XXXX XX X X X X XX XX X X X 62 | X X X X X XX X XX XXX XXX XXXXXX XXX X X XX X XX XXXX XX X X X X XX XX X X X X 59 | X XXXX X X XX X XX XXX XXX XXXXXX XXXX X X XX X XX XX XXXX XX X X X X XX XX XX X X X 56 | X XXXX X X XX X XX XXXX XXX XXXXXX XXXX X X XX X XX XX XXXX XX X X X X XX XX XX X X X 53 | X XXXX X X XXX X XX XXXX XXX XXXXXXX XXXX X X X XX X XX XX XXXX XX X X X X XX XX XX X X X 50 | X XXXX X X XXX XX XX XXXX XXX XXXXXXX XXXX X X X XX X XX XX XXXX XX X X X X XX XX XXXX X X X 47 | X XXXX X X XXX XX XXX XXXX X XXX XXXXXXX XXXX X X X XX XXXX XX X XXXXX XX X X X X XX XX XXXX X X XX 44 | X XXXX X X XXX XX XXX XXXX X XXX XXXXXXX XXXX X X X XX XXXX XX X X XXXXX XX X X X X XX XX XXXX XX X XX 41 | X XXXXX X X XXX XX XXXX XXXX X XXX XXXXXXX XXXX X X XX XX XXXX XX X X XXXXX XXXX XXX X XX XX XXXX XX X XX 38 | X XXXXX XX X XXX XX XXXX XXXX X XXX XXXXXXX XXXX X X XXX XX XXXX XX X X XXXXX XXXXXXXXXX XX XXXXXXX XX X XX 35 | X XXXXX XX X XXX X XX XXXX XXXX X XXX
  • 115. XXXXXXXXXXXX X X XXX XX XXXX XXXXX X XXXXX XXXXXXXXXX XXX XXXXXXX XX X XX 32 | X XXXXX XX X XXX X XX X XXXX XXXX X XXX XXXXXXXXXXXX X X XXX XX XXXX XXXXX X XXXXX XXXXXXXXXX XXX XXXXXXXXXX X XX 29 | X XXXXX XX X XXX X XX X XXXX XXXX X XXX XXXXXXXXXXXX XXX XXX XX XXXX XXXXX X XXXXX XXXXXXXXXX XXX XXXXXXXXXX X XX 26 | XXXXXXX XX X XXX X XX X XXXX XXXX X XXX XXXXXXXXXXXX XXX XXX XXX XXXX XXXXXX X XXXXX XXXXXXXXXX XXX XXXXXXXXXX X XX 23 | XXXXXXX XXXX XXX X XX X XXXX XXXXX X XXX XXXXXXXXXXXX XXX XXX XXX XXXXXXXXXXX X XXXXX XXXXXXXXXX XXX XXXXXXXXXX X XXX 20 | XXXXXXX XXXX XXXXX XXXX XXXX XXXXX X XXX XXXXXXXXXXXX XXX XXX XXX XXXXXXXXXXX X XXXXX XXXXXXXXXXX XXX XXXXXXXXXX X XXX 17 |X XXXXXXXXXXXXXXXXXX XXXX XXXX XXXXX X XXXXXXXXXXXXXXXX XXX XXX XXX XXXXXXXXXXX X XXXXX XXXXXXXXXXX XXX XXXXXXXXXXX X XXX 14 |X XXXXXXXXXXXXXXXXXXXXXXXX XXXX XXXXXXX XXXXXXXXXXXXXXXXX XXX XXX XXXXXXXXXXXXXXX X XXXXXX XXXXXXXXXXX XXX XXXXXXXXXXX XXXXXX 11 |X XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXXXXXXXXXXXXXXX XXX XXX XXXXXXXXXXXXXXX X XXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXX XXXXXX 8 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX XXXXXXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX 5 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  • 116. XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX 2 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX +----+----+----+----+----+----+----+----+----+----+----+----+-- --+----+----+----+----+----+----+----+----+----+----+----+----+-- 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 ENDOUT __MACOSX/a1-code/._test_graph_file_data.sh a1-code/print_graph_demo.o a1-code/deltas_main a1-code/print_graph_demo a1-code/data/short.actual.txt 20 18 14 10 7 2 3 1 5 9 5 7
  • 123. __MACOSX/a1-code/data/._names.txt a1-code/data/big.script put Mary girl put James boy put Patricia girl put John boy put Jennifer girl put Robert boy put Elizabeth girl put Michael boy put Linda girl put William boy put Barbara girl put David boy put Susan girl put Richard boy put Jessica girl put Joseph boy put Margaret girl put Thomas boy put Sarah girl put Charles boy put Karen girl put Christopher boy put Nancy girl put Daniel boy put Betty girl put Matthew boy put Lisa girl put Anthony boy put Dorothy girl put Donald boy put Sandra girl put Mark boy put Ashley girl
  • 124. put Paul boy put Kimberly girl put Steven boy put Donna girl put Andrew boy put Carol girl put Kenneth boy put Michelle girl put George boy put Emily girl put Joshua boy put Amanda girl put Kevin boy put Helen girl put Brian boy put Melissa girl put Edward boy put Deborah girl put Ronald boy put Stephanie girl put Timothy boy put Laura girl put Jason boy put Rebecca girl put Jeffrey boy put Sharon girl put Ryan boy put Cynthia girl put Gary boy put Kathleen girl put Jacob boy put Amy girl put Nicholas boy put Shirley girl put Eric boy put Anna girl
  • 125. put Stephen boy put Angela girl put Jonathan boy put Ruth girl put Larry boy put Brenda girl put Justin boy put Pamela girl put Scott boy put Nicole girl put Frank boy put Katherine girl put Brandon boy put Virginia girl put Raymond boy put Catherine girl put Gregory boy put Christine girl put Benjamin boy put Samantha girl put Samuel boy put Debra girl put Patrick boy put Janet girl put Alexander boy put Rachel girl put Jack boy put Carolyn girl put Dennis boy put Emma girl put Jerry boy put Maria girl put Tyler boy put Heather girl put Aaron boy put Diane girl
  • 126. put Henry boy put Julie girl put Douglas boy put Joyce girl put Jose boy put Evelyn girl put Peter boy put Frances girl put Adam boy put Joan girl put Zachary boy put Christina girl put Nathan boy put Kelly girl put Walter boy put Victoria girl put Harold boy put Lauren girl put Kyle boy put Martha girl put Carl boy put Judith girl put Arthur boy put Cheryl girl put Gerald boy put Megan girl put Roger boy put Andrea girl put Keith boy put Ann girl put Jeremy boy put Alice girl put Terry boy put Jean girl put Lawrence boy put Doris girl
  • 127. put Sean boy put Jacqueline girl put Christian boy put Kathryn girl put Albert boy put Hannah girl put Joe boy put Olivia girl put Ethan boy put Gloria girl put Austin boy put Marie girl put Jesse boy put Teresa girl put Willie boy put Sara girl put Billy boy put Janice girl put Bryan boy put Julia girl put Bruce boy put Grace girl put Jordan boy put Judy girl put Ralph boy put Theresa girl put Roy boy put Rose girl put Noah boy put Beverly girl put Dylan boy put Denise girl put Eugene boy put Marilyn girl put Wayne boy put Amber girl
  • 128. put Alan boy put Madison girl put Juan boy put Danielle girl put Louis boy put Brittany girl put Russell boy put Diana girl put Gabriel boy put Abigail girl put Randy boy put Jane girl put Philip boy put Natalie girl put Harry boy put Lori girl put Vincent boy put Tiffany girl put Bobby boy put Alexis girl put Johnny boy put Kayla girl put Logan boy expand expand expand expand structure save big.hm __MACOSX/a1-code/data/._big.script a1-code/data/hash-demo.script~ add Lucas add Mike
  • 129. add Dustin add Will add El print preorder find Mike find Nancy add Nancy print find Max add Max print find Barb add Barb print save stranger.tree clear print add Demigorgon print load stranger.tree preorder add Jim add Joyce print load stranger.tree print quit __MACOSX/a1-code/data/._hash-demo.script~ a1-code/data/other.script put Lucas brash put Mike DM put Dustin corny
  • 130. put Will lost print get Dustin get El get Lucas get Jim put El weird put Steve hairy put Nancy torn put Barb ran-away? print hashcode Lucas hashcode Barb structure expand structure save stranger.hm clear print structure put Jim cop put Joyce worried print structure get Dustin get Joyce load stranger.hm print structure get Dustin get Joyce put Will found put Nancy decided put Mike girl-crazy print structure
  • 131. next_prime 10 next_prime 25 expand structure put Jim cop put Joyce worried put Erica capitalist put Barb gone put Max gamer put Robin clever save data/other.hm quit __MACOSX/a1-code/data/._other.script a1-code/data/short.txt 20 -2 -4 -4 -3 -5 1 -2 4 4 -4 2 -0 -2 -0 0 2 1
  • 132. -5 4 -3 __MACOSX/a1-code/data/._short.txt a1-code/data/other.hm 23 8 El : weird Barb : ran-away? Lucas : brash Dustin : corny Nancy : decided Mike : girl-crazy Steve : hairy Will : found __MACOSX/a1-code/data/._other.hm a1-code/data/big.script~ put Mary girl put James boy put Patricia girl put John boy put Jennifer girl put Robert boy put Elizabeth girl put Michael boy put Linda girl put William boy put Barbara girl put David boy put Susan girl put Richard boy
  • 133. put Jessica girl put Joseph boy put Margaret girl put Thomas boy put Sarah girl put Charles boy put Karen girl put Christopher boy put Nancy girl put Daniel boy put Betty girl put Matthew boy put Lisa girl put Anthony boy put Dorothy girl put Donald boy put Sandra girl put Mark boy put Ashley girl put Paul boy put Kimberly girl put Steven boy put Donna girl put Andrew boy put Carol girl put Kenneth boy put Michelle girl put George boy put Emily girl put Joshua boy put Amanda girl put Kevin boy put Helen girl put Brian boy put Melissa girl put Edward boy
  • 134. put Deborah girl put Ronald boy put Stephanie girl put Timothy boy put Laura girl put Jason boy put Rebecca girl put Jeffrey boy put Sharon girl put Ryan boy put Cynthia girl put Gary boy put Kathleen girl put Jacob boy put Amy girl put Nicholas boy put Shirley girl put Eric boy put Anna girl put Stephen boy put Angela girl put Jonathan boy put Ruth girl put Larry boy put Brenda girl put Justin boy put Pamela girl put Scott boy put Nicole girl put Frank boy put Katherine girl put Brandon boy put Virginia girl put Raymond boy put Catherine girl put Gregory boy
  • 135. put Christine girl put Benjamin boy put Samantha girl put Samuel boy put Debra girl put Patrick boy put Janet girl put Alexander boy put Rachel girl put Jack boy put Carolyn girl put Dennis boy put Emma girl put Jerry boy put Maria girl put Tyler boy put Heather girl put Aaron boy put Diane girl put Henry boy put Julie girl put Douglas boy put Joyce girl put Jose boy put Evelyn girl put Peter boy put Frances girl put Adam boy put Joan girl put Zachary boy put Christina girl put Nathan boy put Kelly girl put Walter boy put Victoria girl put Harold boy
  • 136. put Lauren girl put Kyle boy put Martha girl put Carl boy put Judith girl put Arthur boy put Cheryl girl put Gerald boy put Megan girl put Roger boy put Andrea girl put Keith boy put Ann girl put Jeremy boy put Alice girl put Terry boy put Jean girl put Lawrence boy put Doris girl put Sean boy put Jacqueline girl put Christian boy put Kathryn girl put Albert boy put Hannah girl put Joe boy put Olivia girl put Ethan boy put Gloria girl put Austin boy put Marie girl put Jesse boy put Teresa girl put Willie boy put Sara girl put Billy boy
  • 137. put Janice girl put Bryan boy put Julia girl put Bruce boy put Grace girl put Jordan boy put Judy girl put Ralph boy put Theresa girl put Roy boy put Rose girl put Noah boy put Beverly girl put Dylan boy put Denise girl put Eugene boy put Marilyn girl put Wayne boy put Amber girl put Alan boy put Madison girl put Juan boy put Danielle girl put Louis boy put Brittany girl put Russell boy put Diana girl put Gabriel boy put Abigail girl put Randy boy put Jane girl put Philip boy put Natalie girl put Harry boy put Lori girl put Vincent boy
  • 138. put Tiffany girl put Bobby boy put Alexis girl put Johnny boy put Kayla girl put Logan boy __MACOSX/a1-code/data/._big.script~ a1-code/data/other.script~ put Lucas brash put Mike DM put Dustin corny put Will lost print get Dustin get El get Lucas get Jim put El weird put Steve hairy put Nancy torn put Barb ran-away? print hashcode Lucas hashcode Barb structure expand structure save stranger.hm clear print structure put Jim cop put Joyce worried
  • 139. print structure get Dustin get Joyce load stranger.hm print structure get Dustin get Joyce put Will found put Nancy decided put Mike girl-crazy print structure next_prime 10 next_prime 25 expand structure put Jim cop put Joyce worried put Erica capitalist put Barb gone put Max gamer save data/other.hm quit __MACOSX/a1-code/data/._other.script~ a1-code/data/names.org | 1 | James | 4,815,847 | Mary | 3,455,228 | | 2 | John | 4,636,242 | Patricia | 1,565,291 | | 3 | Robert | 4,600,785 | Jennifer | 1,464,890 | | 4 | Michael | 4,307,070 | Elizabeth | 1,449,478 | | 5 | William | 3,689,740 | Linda | 1,447,946 |
  • 140. | 6 | David | 3,553,094 | Barbara | 1,413,261 | | 7 | Richard | 2,496,587 | Susan | 1,106,614 | | 8 | Joseph | 2,398,378 | Jessica | 1,042,177 | | 9 | Thomas | 2,179,445 | Margaret | 1,016,433 | | 10 | Charles | 2,161,838 | Sarah | 997,223 | | 11 | Christopher | 2,010,788 | Karen | 984,334 | | 12 | Daniel | 1,866,234 | Nancy | 976,066 | | 13 | Matthew | 1,571,799 | Betty | 964,130 | | 14 | Anthony | 1,394,023 | Lisa | 964,099 | | 15 | Donald | 1,375,006 | Dorothy | 938,467 | | 16 | Mark | 1,342,682 | Sandra | 872,927 | | 17 | Paul | 1,316,094 | Ashley | 840,595 | | 18 | Steven | 1,276,216 | Kimberly | 833,129 | | 19 | Andrew | 1,241,121 | Donna | 825,431 | | 20 | Kenneth | 1,241,110 | Carol | 810,032 | | 21 | George | 1,225,477 | Michelle | 807,515 | | 22 | Joshua | 1,192,510 | Emily | 806,210 | | 23 | Kevin | 1,162,743 | Amanda | 771,396 | | 24 | Brian | 1,161,909 | Helen | 754,741 | | 25 | Edward | 1,146,548 | Melissa | 750,021 | | 26 | Ronald | 1,073,427 | Deborah | 739,055 | | 27 | Timothy | 1,063,014 | Stephanie | 736,098 | | 28 | Jason | 1,023,728 | Laura | 729,905 | | 29 | Jeffrey | 972,144 | Rebecca | 729,158 | | 30 | Ryan | 916,701 | Sharon | 720,788 | | 31 | Gary | 898,893 | Cynthia | 705,176 | | 32 | Jacob | 892,543 | Kathleen | 696,019 | | 33 | Nicholas | 881,085 | Amy | 677,725 | | 34 | Eric | 870,654 | Shirley | 675,723 | | 35 | Stephen | 841,664 | Anna | 661,870 | | 36 | Jonathan | 826,440 | Angela | 656,616 | | 37 | Larry | 802,374 | Ruth | 633,144 | | 38 | Justin | 769,098 | Brenda | 605,962 | | 39 | Scott | 768,539 | Pamela | 592,689 | | 40 | Frank | 753,168 | Nicole | 583,727 | | 41 | Brandon | 749,649 | Katherine | 581,835 |