Initial commit

parents
Showing with 2145 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/JavaCode"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>April_2009</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
package intersections;
import java.util.Hashtable;
import algs.model.ILineSegment;
import algs.model.IPoint;
import algs.model.data.segments.DoubleGenerator;
import algs.model.problems.segmentIntersection.BruteForceAlgorithm;
import algs.model.problems.segmentIntersection.LineSweep;
/**
* Investigate what happens with the behavior of two line intersecting algorithms as the
* number of random line segments increases.
*
* @author George Heineman
*/
public class Generator {
public static void main(String[] args) {
System.out.println("n,lineSweep,bruteForce");
for (int n = 32; n <= 2048; n *= 2) {
LineSweep ls = new LineSweep();
BruteForceAlgorithm bfa = new BruteForceAlgorithm();
// generate segments
DoubleGenerator dg = new DoubleGenerator (1.0, 0.25);
ILineSegment ils[] = dg.generate(n);
// run both algorithms
Hashtable<IPoint, ILineSegment[]> sweepResults = ls.intersections(ils);
Hashtable<IPoint, ILineSegment[]> bruteForceResults = bfa.intersections(ils);
System.out.println(n + "," + sweepResults.size() + "," + bruteForceResults.size());
}
}
}
package intersections;
import java.util.Hashtable;
import algs.model.ILineSegment;
import algs.model.IPoint;
import algs.model.problems.segmentIntersection.BruteForceAlgorithm;
import algs.model.problems.segmentIntersection.LineSweep;
import algs.model.twod.TwoDLineSegment;
/**
* Example showing how near-vertical input lines cause problems with LineSweep.
*
* @author George Heineman
* @date 05/13/2009
*/
public class NearVerticalProblem {
static ILineSegment[] segments = new ILineSegment[] {
new TwoDLineSegment(0.145721433,0.105568686, 0.14572143,0.8),
new TwoDLineSegment(0.079389892,0.243921955,.21,0),
new TwoDLineSegment(0.094178956,0.536624491,.6,.5),
};
public static void main(String[] args) {
// show slopes of input sets
for (int i = 0; i < segments.length; i++) {
IPoint start = segments[i].getStart();
IPoint end = segments[i].getEnd();
double slope = (end.getY() - start.getY())/ (end.getX() - start.getX());
System.out.println("slope of " + i + "th line is " + slope);
}
LineSweep dba = new LineSweep();
BruteForceAlgorithm bfa = new BruteForceAlgorithm();
// causes failure.
Hashtable<IPoint, ILineSegment[]> res = dba.intersections(segments);
report (res);
res = bfa.intersections(segments);
report (res);
}
private static void report(Hashtable<IPoint, ILineSegment[]> res) {
System.out.println(res.size() + " intersection points.");
for (IPoint ip : res.keySet()) {
ILineSegment ils[] = res.get(ip);
System.out.println(ip + ":");
for (int i = 0; i <ils.length; i++) {
System.out.println(" " + ils[i]);
}
System.out.println();
}
}
}
package intersections;
import java.util.Hashtable;
import algs.model.ILineSegment;
import algs.model.IPoint;
import algs.model.problems.segmentIntersection.BruteForceAlgorithm;
import algs.model.problems.segmentIntersection.LineSweep;
import algs.model.twod.TwoDLineSegment;
/**
* Example showing how floating point errors result in different output results.
*
* @author George Heineman
* @date 05/13/2009
*/
public class Validate {
static ILineSegment[] segments = new ILineSegment[] {
new TwoDLineSegment(0.145721433,0.105568686,0,0),
new TwoDLineSegment(0.079389892,0.043921955,0,0),
new TwoDLineSegment(0.094178956,0.036624491,0,0),
};
public static void main(String[] args) {
LineSweep dba = new LineSweep();
BruteForceAlgorithm bfa = new BruteForceAlgorithm();
// causes failure.
Hashtable<IPoint, ILineSegment[]> res = dba.intersections(segments);
report (res);
res = bfa.intersections(segments);
report (res);
}
private static void report(Hashtable<IPoint, ILineSegment[]> res) {
System.out.println(res.size() + " intersection points.");
for (IPoint ip : res.keySet()) {
ILineSegment ils[] = res.get(ip);
System.out.println(ip + ":");
for (int i = 0; i <ils.length; i++) {
System.out.println(" " + ils[i]);
}
System.out.println();
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
<classpathentry combineaccessrules="false" kind="src" path="/JavaCode"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>December_2008</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
aal
aalii
aani
aardvark
aardwolf
aaronite
ababdeh
ababua
abaca
abacination
abacist
abaff
abama
abarambo
abasgi
abastardize
abave
abbadide
abdominoscope
abhiseka
abiotrophy
acenaphthenyl
achomawi
acyloxy
ajaja
baa
baahling
baalath
baalish
baalize
baalshem
baba
babasco
babbie
babbittry
babblative
babblesome
babblingly
babehood
babelike
babiche
babongo
babua
bacillicide
backdown
backrope
backshift
baetyl
balija
bandboxy
caam
caama
caaming
caapeba
caatinga
caback
cabaho
cabala
cabalassou
cabaletta
cabalic
cabalism
caballer
cabda
cabestro
cablelike
cabreuva
cabuya
cacatua
cachaza
cachexy
cacoepy
caffa
caraja
cawk
daalder
dabb
dabbling
dabblingly
dabblingness
dabchick
dabih
daboya
daceloninae
dacha
dacite
dacoitage
dacryagogue
dacryocystorhinostomy
dacryon
dacryops
dactylopore
dactylorhiza
daddocky
dadenhudd
daff
daijo
daiva
daydawn
dermatauxe
eachwhere
eagerly
eagerness
eaglelike
eaglestone
eaglet
eaglewood
ean
earache
earful
earlobe
earlock
earlship
earmuff
earnings
earthslide
eatability
ebionize
ebullioscope
ebullitive
ecchondroma
echimys
ehuawa
elcaja
enterauxe
faba
fabaceae
fabaceous
fabella
fabes
fabianism
fabiform
fabledom
fableland
fabricative
fabrikoid
fabulosity
facedown
facepiece
fackings
facks
facsimilize
facticide
faff
fairtime
faithworthy
felichthys
ferrotype
fiji
flaxy
gabbard
gabber
gabblement
gabbroic
gabby
gabelle
gabelleman
gabfest
gabion
gabionade
gabionage
gablelike
gablock
gabrielrache
gadabout
gadolinite
gaelicize
gaffkya
gaincome
gainstrive
galactoscope
gallify
ganja
garawi
gastrohysteropexy
haab
habanera
habbe
habble
habena
habenaria
habendum
haberdash
haberdasher
habergeon
habilitate
habitance
habitative
habitualize
habitude
habronema
habutaye
hache
hacky
hadendowa
hadji
haemaspectroscope
haemorrhage
haff
hemiataxy
iacchic
iacchos
iacchus
iachimo
iamatology
iambe
iambically
iambist
iambize
iambographer
ianthina
ianthinite
iao
iatraliptics
iatrochemistry
icecraft
icelike
icerya
ichnography
ichthyopsida
iconograph
ideative
iiwi
ijo
intext
iraqi
jaalin
jabarite
jabbed
jabbering
jabberingly
jabberwock
jabberwockian
jabberwocky
jabers
jaborandi
jabot
jaboticaba
jabul
jacamerops
jacami
jacinthe
jackanapish
jackshaft
jacobinize
jaculative
jacutinga
jambalaya
jawy
jinja
kababish
kabaka
kabaragoya
kabard
kabardian
kabbeljaws
kabel
kabirpanthi
kabob
kabonga
kabuli
kachin
kadarite
kadikane
kadmi
kadu
kafa
kaffeeklatsch
kakapo
kalidium
kamba
kanauji
kaolinize
kataplexy
kavi
laager
laang
labara
labarum
labba
labdacism
labefact
labefactation
labefy
labella
labellate
labelloid
labialize
labiatae
labiograph
laborage
laborsome
labrys
lacelike
lacerative
lache
lactamide
lambsdown
laparohysteropexy
lija
maam
maamselle
maba
mabellona
mabinogion
macaasim
macabresque
macaca
macadamite
macadamize
macadamizer
macanese
macaranga
macduff
machi
machinofacture
machopolyp
macklike
macrodome
macrograph
madhva
madi
maharaja
markdown
martext
naa
naassenes
nabalism
nabalite
nabalitic
nabaloi
nabalus
nabby
nable
nabobery
nacarine
nace
naebody
naga
nagaika
naght
naja
nakedize
nama
napa
naphthyl
narrative
narrowy
naturecraft
nephrauxe
oadal
oafdom
oafish
oafishly
oakberry
oakesia
oaklet
oaklike
oakling
oaktongue
oarage
oarcock
oariopathy
oariotomy
oatfowl
oaty
obclude
obe
obelize
obispo
objectative
obstupefy
oceanways
omentopexy
ouija
paal
paauw
paba
pabble
pabouch
pabulary
pabulation
pacate
pacative
pacaya
paccanarist
paced
pacemaking
pacht
pachyacria
pachyderma
packstaff
padda
paddlelike
padge
paeanize
pagoscope
pakawa
panmixy
ponja
qasida
qere
qintar
qoheleth
qoph
quachil
quackhood
quackish
quackishly
quacksalver
quacky
quadragenarious
quadragesima
quadrans
quadratics
quadriderivative
quadriga
quakerize
quarterstaff
quashy
quawk
qubba
quillaja
quimbaya
quinisext
raad
raash
raband
rabatte
rabbin
rabbindom
rabbinica
rabbinically
rabbinize
rabbitberry
rabbiter
rabbitlike
rabblesome
rabi
rabulous
rache
rachigraph
rada
raddlings
radiative
rafe
rainbowy
raja
raya
rectopexy
saa
saarbrucken
saba
sabadilla
sabadine
sabaeanism
sabanut
sabaoth
sabathikos
sabbatary
sabbathaic
sabbathize
sabbathlike
sabbitha
sabdariffa
sabeca
sabuja
saccharamide
saccharoceptive
saccharoscope
saccomys
sacerdotage
sacktime
sallowy
salpingopexy
taa
taalbond
tabacin
tabacum
tabaniform
tabanuco
tabarded