JAVA – Finding the shortest three-letter-word sequence between these two words…?
A three-letter-word sequence is a sequence (any sequence) of three-letter words so that any two adjacent words differ by exactly one letter. For example, BED, TED, TEN, MEN, HEN, HUN. Before you ask, here is a list I am given of allowable three-letter-words titled A3word.input:
AAH AAL AAS ABA ABO ABS ABY ACE ACT ADD ADO ADS ADZ AFF AFT AGA AGE AGO AHA AID
AIL AIM AIN AIR AIS AIT ALA ALB ALE ALL ALP ALS ALT AMA AMI AMP AMU ANA AND ANE
ANI ANT ANY APE APT ARB ARC ARE ARF ARK ARM ARS ART ASH ASK ASP ASS ATE ATT AUK
AVA AVE AVO AWA AWE AWL AWN AXE AYE AYS AZO
BAA BAD BAG BAH BAL BAM BAN BAP BAR BAS BAT BAY BED BEE BEG BEL BEN BET BEY BIB
BID BIG BIN BIO BIS BIT BIZ BOA BOB BOD BOG BOO BOP BOS BOT BOW BOX BOY BRA BRO
BRR BUB BUD BUG BUM BUN BUR BUS BUT BUY BYE BYS
CAB CAD CAM CAN CAP CAR CAT CAW CAY CEE CEL CEP CHI CIS COB COD COG COL CON COO
COP COR COS COT COW COX COY COZ CRY CUB CUD CUE CUM CUP CUR CUT CWM
DAB DAD DAG DAH DAK DAL DAM DAP DAW DAY DEB DEE DEL DEN DEV DEW DEX DEY DIB DID
DIE DIG DIM DIN DIP DIS DIT DOC DOE DOG DOL DOM DON DOR DOS DOT DOW DRY DUB DUD
DUE DUG DUI DUN DUO DUP DYE
EAR EAT EAU EBB ECU EDH EEL EFF EFS EFT EGG EGO EKE ELD ELF ELK ELL ELM ELS EME
EMF EMS EMU END ENG ENS EON ERA ERE ERG ERN ERR ERS ESS ETA ETH EVE EWE EYE
FAD FAG FAN FAR FAS FAT FAX FAY FED FEE FEH FEM FEN FER FET FEU FEW FEY FEZ FIB
FID FIE FIG FIL FIN FIR FIT FIX FIZ FLU FLY FOB FOE FOG FOH FON FOP FOR FOU FOX
FOY FRO FRY FUB FUD FUG FUN FUR
GAB GAD GAE GAG GAL GAM GAN GAP GAR GAS GAT GAY GED GEE GEL GEM GEN GET GEY GHI
GIB GID GIE GIG GIN GIP GIT GNU GOA GOB GOD GOO GOR GOT GOX GOY GUL GUM GUN GUT
GUV GUY GYM GYP
HAD HAE HAG HAH HAJ HAM HAO HAP HAS HAT HAW HAY HEH HEM HEN HEP HER HES HET HEW
HEX HEY HIC HID HIE HIM HIN HIP HIS HIT HMM HOB HOD HOE HOG HON HOP HOT HOW HOY
HUB HUE HUG HUH HUM HUN HUP HUT HYP
ICE ICH ICK ICY IDS IFF IFS ILK ILL IMP INK INN INS ION IRE IRK ISM ITS IVY
JAB JAG JAM JAR JAW JAY JEE JET JEU JEW JIB JIG JIN JOB JOE JOG JOT JOW JOY JUG
JUN JUS JUT
KAB KAE KAF KAS KAT KAY KEA KEF KEG KEN KEP KEX KEY KHI KID KIF KIN KIP KIR KIT
KOA KOB KOI KOP KOR KOS KUE
LAB LAC LAD LAG LAM LAP LAR LAS LAT LAV LAW LAX LAY LEA LED LEE LEG LEI LEK LET
LEU LEV LEX LEY LEZ LIB LID LIE LIN LIP LIS LIT LOB LOG LOO LOP LOT LOW LOX LUG
LUM LUV LUX LYE
MAC MAD MAE MAG MAN MAP MAR MAS MAT MAW MAX MAY MED MEL MEM MEN MET MEW MHO MIB
MID MIG MIL MIM MIR MIS MIX MOA MOB MOC MOD MOG MOL MOM MON MOO MOP MOR MOS MOT
MOW MUD MUG MUM MUN MUS MUT
NAB NAE NAG NAH NAM NAN NAP NAW NAY NEB NEE NET NEW NIB NIL NIM NIP NIT NIX NOB
NOD NOG NOH NOM NOO NOR NOS NOT NOW NTH NUB NUN NUS NUT
OAF OAK OAR OAT OBE OBI OCA ODD ODE ODS OES OFF OFT OHM OHO OHS OIL OKA OKE OLD
OLE OMS ONE ONS OOH OOT OPE OPS OPT ORA ORB ORC ORE ORS ORT OSE OUD OUR OUT OVA
OWE OWL OWN OXO OXY
PAC PAD PAH PAL PAM PAN PAP PAR PAS PAT PAW PAX PAY PEA PEC PED PEE PEG PEH PEN
PEP PER PES PET PEW PHI PHT PIA PIC PIE PIG PIN PIP PIS PIT PIU PIX PLY POD POH
POI POL POM POP POT POW POX PRO PRY PSI PUB PUD PUG PUL PUN PUP PUR PUS PUT PYA
RAD RAG RAH RAJ RAM RAN RAP RAS RAT RAW RAX RAY REB REC RED REE REF REG REI REM
REP RES RET REV REX RHO RIA RIB RID RIF RIG RIM RIN RIP ROB ROC ROD ROE ROM ROT
ROW RUB RUE RUG RUM RUN RUT RYA RYE
SAB SAC SAD SAE SAG SAL SAP SAT SAU SAW SAX SAY SEA SEC SEE SEG SEI SEL SEN SER
SET SEW SEX SHA SHE SHH SHY SIB SIC SIM SIN SIP SIR SIS SIT SIX SKA SKI SKY SLY
SOB SOD SOL SON SOP SOS SOT SOU SOW SOX SOY SPA SPY SRI STY SUB SUE SUM SUN SUP
TAB TAD TAE TAG TAJ TAM TAN TAO TAP TAR TAS TAT TAU TAV TAW TAX TEA TED TEE TEG
TEL TEN TET TEW THE THO THY TIC TIE TIL TIN TIP TIS TIT TOD TOE TOG TOM TON TOO
TOP TOR TOT TOW TOY TRY TSK TUB TUG TUI TUN TUP TUT TUX TWA TWO TYE
UDO UGH UKE ULU UMM UMP UNS UPO UPS URB URD URN USE UTA UTS
VAC VAN VAR VAS VAT VAU VAV VAW VEE VEG VET VEX VIA VIE VIG VIM VIS VOE VOW VOX
WAB WAD WAE WAG WAN WAP WAR WAS WAT WAW WAX WAY WEB WED WEE WEN WET WHA WHO WHY
WIG WIN WIS WIT WIZ WOE WOG WOK WON WOO WOP WOS WOT WOW WRY WUD WYE WYN
YAH YAK YAM YAP YAR YAW YAY YEA YEH YEN YEP YES YET YEW YID YIN YIP YOB YOD YOK
YOM YON YOU YOW YUK YUM YUP
ZAG ZAP ZAX ZED ZEE ZEK ZIG ZIN ZIP ZIT ZOA ZOO
We need to find the shortest three-letter-word sequence (example, in the example above it took 5 moves to get from BED to HUN). Find the shortest three-letter-word sequnece that connects the words (if they exist):
1. IVY to LAB
2. OAK to ICE
3. ICY to LIE
(backwards order is okay).
We need to do this with JAVA. If anyone could help it would be appreciated. Thank you!
I would create a graph with each word a node and the edges connecting the nodes that are only one letter apart. Then, use Djikstra’s shortest-path algorithm to find your sequence
Ive always wondered?? is this blasphemy?
im christian and ive always wondered this: you know that some shows like Family Guy, South Park etc sometimes have Jesus in them, sometimes as a joke, an example is when in S. Park he swtchs a jog of water with a jug of wine and tells the children he made wine, if u laugh at that as a Christian, is that considered blasphemy or does Jesus also laugh it off and take it as a joke (as it is), considering i hav my beliefs no matter how much of a joke it is, i still believe in Jesus…
so my question is: if u laugh at those jokes is that blasphemy?
or Jesus and God laugh it off
i get how its a bit offensive but i would think that God has a sense of humor too and it doesnt change my faith in any way whatsoever…
Some would argue that god is so holy, divine, powerful, wonderful, etc, that to consider him in any other context (humor) would be blasphemous
others would argue that BECAUSE god is so holy, powerful, wonderful, that he loves to see humans laughing as long as it’s not at the detriment of someone.
He’d probably rather you laugh at him (he can take it) than someone with self esteem issues.
Will jugging rise my metabolism?
I’ve been going to the gym for 2 years now. In the summer I’ve always toke a break. Now I’m starting the summer break again and I want to know if jogging will ‘keep my motor’ running for the summer. Me and my classmates like to go jogging and I was thinking if running with them plus some home workout could mentain my muscles and make me stay thin.
Eating breakfast will do a lot for metabolism. Your body is on slow mo till you eat your first meal. So breakfast will pop it up early in the am. Jogging will help if you gain muscle mass in the legs. Muscle burns calories.
I find that it can be counter productive. Setting aside one action to keep your body fit is too easy to neglect. I prefer to do different exercises through out the day that keep my heart rate up and work all different parts of the body. Yoga and Palites have really amazed me. Not only do I gain strong enduring muscles I also gain coordination, flexibility, balance… List goes one. I can do it any time almost any where. Weather does not interfere. Thats just my 2cent.
Ps. Because a lot of women also like these regimes it is an excellent way to meet some healthy ladies.
Would this be a good workout?
If I were to carry one 1 gallon jug with water in each hand (two total) and jog around a 10 mile lake?
A gallon of water weighs about 8.34 LBS.
the point of the gallons are to build up arm muscle.
Ya i say it would be, but ppl might think ur CRAZY!!!!
Were they witches? Or doing witchcraft? Pigs blood?
I went jogging through a forest-path that is usually pretty busy with people walking their dogs and stuff. It was sort of getting dark, and there were two girls… one older woman, and a young girl sitting on the side of the path in the middle of the woods.
They had like bags, and blankets and weird stuff, and two HUGE glass jug container things full of blood. One blood was dark and the other was thinner. I got a weird feeling and couldn’t read the label but it did say blood. Do you think they were doing witchcraft? Thoughts?
The thin blood was most likely animal blood, and the thick could be human. Theyre probably not witches, they’re probably people, but they may be trying to perform a ritual to bring them closer to a spirit.
Many rituals involve concoctions of human and other blood types, so it may very well be a ritual of sorts
Powered by Yahoo! Answers