Hidden in the grid below are the names of several animals. The letters are hidden in sequence using the moves of a chess knight. For example, if the first letter of one of the animals was the...

1 answer below »
Hidden in the grid below are the names of several animals. The letters are hidden in sequence using the moves of a chess knight. For example, if the first letter of one of the animals was the top-right F, then the second letter could only be either F or A.


Write a program (any language) that helps you find the animals by finding all embedded words that are 4 or more letters in length that are also on this word list. The animals should be among the words that are found. Describe how your algorithm works and what the runtime is. You have no restrictions on what data structures or algorithms you use.


Aarhus Aaron Ababa aback abaft abandon abandoned abandoning abandonment abandons abase abased abasement abasements abases abash abashed abashes abashing abasing abate abated abatement abatements abater abates abating Abba abbe abbey abbeys abbot abbots Abbott abbreviate abbreviated abbreviates abbreviating abbreviation abbreviations Abby abdomen abdomens abdominal abduct abducted abduction abductions abductor abductors abducts Abe abed Abel Abelian Abelson Aberdeen Abernathy aberrant aberration aberrations abet abets abetted abetter abetting abeyance abhor abhorred abhorrent abhorrer abhorring abhors abide abided abides abiding Abidjan Abigail Abilene abilities ability abject abjection abjections abjectly abjectness abjure abjured abjures abjuring ablate ablated ablates ablating ablation ablative ablaze able abler ablest ably Abner abnormal abnormalities abnormality abnormally Abo aboard abode abodes abolish abolished abolisher abolishers abolishes abolishing abolishment abolishments abolition abolitionist abolitionists abominable abominate aboriginal aborigine aborigines abort aborted aborting abortion abortions abortive abortively aborts Abos abound abounded abounding abounds about above aboveboard aboveground abovementioned abrade abraded abrades abrading Abraham Abram Abrams Abramson abrasion abrasions abrasive abreaction abreactions abreast abridge abridged abridges abridging abridgment abroad abrogate abrogated abrogates abrogating abrupt abruptly abruptness abscess abscessed abscesses abscissa abscissas abscond absconded absconding absconds absence absences absent absented absentee absenteeism absentees absentia absenting absently absentminded absents absinthe absolute absolutely absoluteness absolutes absolution absolve absolved absolves absolving absorb absorbed absorbency absorbent absorber absorbing absorbs absorption absorptions absorptive abstain abstained abstainer abstaining abstains abstention abstentions abstinence abstract abstracted abstracting abstraction abstractionism abstractionist abstractions abstractly abstractness abstractor abstractors abstracts abstruse abstruseness absurd absurdities absurdity absurdly Abu abundance abundant abundantly abuse abused abuses abusing abusive abut abutment abuts abutted abutter abutters abutting abysmal abysmally abyss abysses Abyssinia Abyssinian Abyssinians acacia academia academic academically academics academies academy Acadia Acapulco accede acceded accedes accelerate accelerated accelerates accelerating acceleration accelerations accelerator accelerators accelerometer accelerometers accent accented accenting accents accentual accentuate accentuated accentuates accentuating accentuation accept acceptability acceptable acceptably acceptance acceptances accepted accepter accepters accepting acceptor acceptors accepts access accessed accesses accessibility accessible accessibly accessing accession accessions accessories accessors accessory accident accidental accidentally accidently accidents acclaim acclaimed acclaiming acclaims acclamation acclimate acclimated acclimates acclimating acclimatization acclimatized accolade accolades accommodate accommodated accommodates accommodating accommodation accommodations accompanied accompanies accompaniment accompaniments accompanist accompanists accompany accompanying accomplice accomplices accomplish accomplished accomplisher accomplishers accomplishes accomplishing accomplishment accomplishments accord accordance accorded accorder accorders according accordingly accordion accordions accords accost accosted accosting accosts account accountability accountable accountably accountancy accountant accountants accounted accounting accounts Accra accredit accreditation accreditations accredited accretion accretions accrue accrued accrues accruing acculturate acculturated acculturates acculturating acculturation accumulate accumulated accumulates accumulating accumulation accumulations accumulator accumulators accuracies accuracy accurate accurately accurateness accursed accusal accusation accusations accusative accuse accused accuser accuses accusing accusingly accustom accustomed accustoming accustoms ace aces acetate acetone acetylene Achaean Achaeans ache ached aches achievable achieve achieved achievement achievements achiever achievers achieves achieving Achilles aching acid acidic acidities acidity acidly acids acidulous Ackerman Ackley acknowledge acknowledgeable acknowledged acknowledgement acknowledgements acknowledger acknowledgers acknowledges acknowledging acknowledgment acknowledgments acme acne acolyte acolytes acorn acorns acoustic acoustical acoustically acoustician acoustics acquaint acquaintance acquaintances acquainted acquainting acquaints acquiesce acquiesced acquiescence acquiescent acquiesces acquiescing acquirable acquire acquired acquires acquiring acquisition acquisitions acquisitive acquisitiveness acquit acquits acquittal acquitted acquitter acquitting acre acreage acres acrid acrimonious acrimony acrobat acrobatic acrobatics acrobats acronym acronyms acropolis across acrylic act Acta Actaeon acted acting actinium actinometer actinometers action actions activate activated activates activating activation activations activator activators active actively activism activist activists activities activity Acton actor actors actress actresses Acts actual actualities actuality actualization actually actuals actuarial actuarially actuate actuated actuates actuating actuator actuators acuity acumen acute acutely acuteness acyclic acyclically ad Ada adage adages adagio adagios Adair Adam adamant adamantly Adams Adamson adapt adaptability adaptable adaptation adaptations adapted adapter adapters adapting adaptive adaptively adaptor adaptors adapts add added addend addenda addendum adder adders addict addicted addicting addiction addictions addicts adding Addis Addison addition additional additionally additions additive additives additivity address addressability addressable addressed addressee addressees addresser addressers addresses addressing Addressograph adds adduce adduced adduces adducible adducing adduct adducted adducting adduction adductor adducts Adelaide Adele Adelia Aden adept adequacies adequacy adequate adequately adhere adhered adherence adherent adherents adherer adherers adheres adhering adhesion adhesions adhesive adhesives adiabatic adiabatically adieu Adirondack Adirondacks adjacency adjacent adjective adjectives adjoin adjoined adjoining adjoins adjourn adjourned adjourning adjournment adjourns adjudge adjudged adjudges adjudging adjudicate adjudicated adjudicates adjudicating adjudication adjudications adjunct adjuncts adjure adjured adjures adjuring adjust adjustable adjustably adjusted adjuster adjusters adjusting adjustment adjustments adjustor adjustors adjusts adjutant adjutants Adkins Adler Adlerian administer administered administering administerings administers administrable administrate administration administrations administrative administratively administrator administrators admirable admirably admiral admirals admiralty admiration admirations admire admired admirer admirers admires admiring admiringly admissibility admissible admission admissions admit admits admittance admitted admittedly admitter admitters admitting admix admixed admixes admixture admonish admonished admonishes admonishing admonishment admonishments admonition admonitions ado adobe adolescence adolescent adolescents Adolph Adolphus Adonis adopt adopted adopter adopters adopting adoption adoptions adoptive adopts adorable adoration adore adored adores adorn adorned adornment adornments adorns adrenal adrenaline Adrian Adriatic Adrienne adrift adroit adroitness ads adsorb adsorbed adsorbing adsorbs adsorption adulate adulating adulation adult adulterate adulterated adulterates adulterating adulterer adulterers adulterous adulterously adultery adulthood adults adumbrate adumbrated adumbrates adumbrating adumbration advance advanced advancement advancements advances advancing advantage advantaged advantageous advantageously advantages advent adventist adventists adventitious adventure adventured adventurer adventurers adventures adventuring adventurous adverb adverbial adverbs adversaries adversary adverse adversely adversities adversity advert advertise advertised advertisement advertisements advertiser advertisers advertises advertising advice advisability advisable advisably advise advised advisedly advisee advisees advisement advisements adviser advisers advises advising advisor advisors advisory advocacy advocate advocated advocates advocating Aegean aegis Aeneas Aeneid Aeolus aerate aerated aerates aerating aeration aerator aerators aerial aerials aeroacoustic Aerobacter aerobic aerobics aerodynamic aerodynamics aeronautic aeronautical aeronautics aerosol aerosolize aerosols aerospace Aeschylus Aesop aesthetic aesthetically aesthetics afar affable affair affairs affect affectation affectations affected affecting affectingly affection affectionate affectionately affections affective affects afferent affianced affidavit affidavits affiliate affiliated affiliates affiliating affiliation affiliations affinities affinity affirm affirmation affirmations affirmative affirmatively affirmed affirming affirms affix affixed affixes affixing afflict afflicted afflicting affliction afflictions afflictive afflicts affluence affluent afford affordable afforded affording affords affricate affricates affright affront affronted affronting affronts Afghan Afghanistan Afghans aficionado afield afire aflame afloat afoot afore aforementioned aforesaid aforethought afoul afraid afresh Africa African Africanization Africanizations Africanize Africanized Africanizes Africanizing Africans Afrikaans Afrikaner Afrikaners aft after aftereffect afterglow afterimage afterlife aftermath aftermost afternoon afternoons aftershock aftershocks afterthought afterthoughts afterward afterwards again against Agamemnon agape agar agate agates Agatha age aged Agee ageless agencies agency agenda agendas agent agents ager agers ages Aggie Aggies agglomerate agglomerated agglomerates agglomeration agglutinate agglutinated agglutinates agglutinating agglutination agglutinin agglutinins aggrandize aggravate aggravated aggravates aggravation aggregate aggregated aggregately aggregates aggregating aggregation aggregations aggression aggressions aggressive aggressively aggressiveness aggressor aggressors aggrieve aggrieved aggrieves aggrieving aghast agile agilely agility aging agitate agitated agitates agitating agitation agitations agitator agitators agleam aglow Agnes Agnew agnostic agnostics ago agog agonies agonize agonized agonizes agonizing agonizingly agony agrarian agree agreeable agreeably agreed agreeing agreement agreements agreer agreers agrees Agricola agricultural agriculturally agriculture ague Agway ah ahead Ahmadabad Ahmedabad aid Aida aide aided Aides aiding aids Aiken ail Aileen aileron ailerons ailing ailment ailments aim aimed aimer aimers aiming aimless aimlessly aims Ainu Ainus air airbag airbags airborne Airbus aircraft airdrop airdrops aired Airedale airer airers Aires airfare airfield airfields airflow airfoil airfoils airframe airframes airily airing airings airless airlift airlifts airline airliner airlines airlock airlocks airmail airmails airman airmen airplane airplanes airport airports airs airship airships airspace airspeed airstrip airstrips airtight airway airways airy aisle Aitken ajar Ajax Akers akimbo akin Akron Al Alabama Alabamans Alabamian alabaster alacrity Aladdin Alameda Alamo Alamos Alan Alar alarm alarmed alarming alarmingly alarmist alarms alas Alaska Alaskan Alastair alba albacore Albania Albanian Albanians Albany albatross albeit Alberich Albert Alberta Alberto Albrecht Albright album albumin albums Albuquerque Alcestis alchemy Alcibiades Alcmena Alcoa alcohol alcoholic alcoholics alcoholism alcohols Alcott alcove alcoves Aldebaran Alden alder alderman aldermen Aldrich ale Alec Aleck alee alert alerted alertedly alerter alerters alerting alertly alertness alerts Aleut Aleutian Alex Alexander Alexandra Alexandre Alexandria Alexandrine Alexei Alexis Alfa alfalfa Alfonso Alfred Alfredo alfresco alga algae algaecide algebra algebraic algebraically algebras Algenib Alger Algeria Algerian Algiers alginate ALGOL Algol Algonquian Algonquin algorithm algorithmic algorithmically algorithms Alhambra Ali alias aliased aliases aliasing alibi alibis Alice Alicia alien alienate alienated alienates alienating alienation aliens alight align aligned aligning alignment alignments aligns alike aliment aliments alimony Alison Alistair alive alkali alkaline alkalis alkaloid alkaloids alkyl all Allah Allan allay allayed allaying allays allegation allegations allege alleged allegedly alleges Alleghenies Allegheny allegiance allegiances alleging allegoric allegorical allegorically allegories allegory Allegra allegretto allegrettos allele alleles allemande Allen Allendale Allentown allergic allergies allergy alleviate alleviated alleviates alleviating alleviation alley alleys alleyway alleyways alliance alliances allied allies alligator alligators Allis Allison alliteration alliterations alliterative allocatable allocate allocated allocates allocating allocation allocations allocator allocators allophone allophones allophonic allot allotment allotments allots allotted allotter allotting allow allowable allowably allowance allowances allowed allowing allows alloy alloys Allstate allude alluded alludes alluding allure allurement alluring allusion allusions allusive allusiveness ally allying Allyn alma Almaden almanac almanacs almighty almond almonds almoner almost alms almsman alnico aloe aloes aloft aloha alone aloneness along alongside aloof aloofness aloud Alpert alpha alphabet alphabetic alphabetical alphabetically alphabetics alphabetize alphabetized alphabetizes alphabetizing alphabets alphanumeric Alpheratz Alphonse alpine Alps already Alsatian Alsatians also Alsop Altair altar altars alter alterable alteration alterations altercation altercations altered alterer alterers altering alternate alternated alternately alternates alternating alternation alternations alternative alternatively alternatives alternator alternators alters Althaea although altitude altitudes altogether Alton Altos altruism altruist altruistic altruistically alum aluminum alumna alumnae alumni alumnus alundum Alva Alvarez alveolar alveoli alveolus Alvin always Alyssa am Amadeus amain amalgam amalgamate amalgamated amalgamates amalgamating amalgamation amalgams Amanda amanuensis amaretto Amarillo amass amassed amasses amassing amateur amateurish amateurishness amateurism amateurs amatory amaze amazed amazedly amazement amazer amazers amazes amazing amazingly Amazon Amazons ambassador ambassadors amber ambiance ambidextrous ambidextrously ambient ambiguities ambiguity ambiguous ambiguously ambition ambitions ambitious ambitiously ambivalence ambivalent ambivalently amble ambled ambler ambles ambling ambrosial ambulance ambulances ambulatory ambuscade ambush ambushed ambushes Amdahl Amelia ameliorate ameliorated ameliorating amelioration amen amenable amend amended amending amendment amendments amends amenities amenity amenorrhea Amerada America American Americana Americanism Americanization Americanizations Americanize Americanizer Americanizers Americanizes Americans Americas americium Ames Amharic Amherst amiable amicable amicably amid amide amidst Amiga amigo amino amiss amity Amman Ammerman ammo ammonia ammoniac ammonium ammunition amnesty Amoco amoeba amoebae amoebas amok among amongst Amontillado amoral amorality amorist amorous amorphous amorphously amortize amortized amortizes amortizing Amos amount amounted amounter amounters amounting amounts amour amperage ampere amperes ampersand ampersands Ampex amphetamine amphetamines amphibian amphibians amphibious amphibiously amphibology amphitheater amphitheaters ample amplification amplified amplifier amplifiers amplifies amplify amplifying amplitude amplitudes amply ampoule ampoules amputate amputated amputates amputating Amsterdam Amtrak amulet amulets amuse amused amusedly amusement amusements amuser amusers amuses amusing amusingly Amy amyl an Anabaptist Anabaptists Anabel anachronism anachronisms anachronistically anaconda anacondas Anacreon anaerobic anagram anagrams Anaheim anal Analects analog analogical analogies analogous analogously analogue analogues analogy analyses analysis analyst analysts analytic analytical analytically analyticities analyticity analyzable analyze analyzed analyzer analyzers analyzes analyzing anaphora anaphoric anaphorically anaplasmosis anarchic anarchical anarchism anarchist anarchists anarchy Anastasia anastomoses anastomosis anastomotic anathema Anatole Anatolia Anatolian anatomic anatomical anatomically anatomy ancestor ancestors ancestral ancestry anchor anchorage anchorages anchored anchoring anchorite anchoritism anchors anchovies anchovy ancient anciently ancients ancillary and Andalusia Andalusian Andalusians Andean anders Andersen Anderson Andes anding Andorra Andover Andre Andrea Andrei Andrew Andrews Andromache Andromeda Andy anecdotal anecdote anecdotes anechoic anemia anemic anemometer anemometers anemometry anemone anesthesia anesthetic anesthetically anesthetics anesthetize anesthetized anesthetizes anesthetizing anew angel Angela Angeleno Angelenos Angeles angelic Angelica Angelina Angeline Angelo angels anger angered angering angers Angie angiography angle angled angler anglers Angles Anglia Anglican Anglicanism Anglicanize Anglicanizes Anglicans angling Anglo Anglophilia Anglophobia Angola Angora angrier angriest angrily angry angst angstrom anguish anguished angular angularly Angus Anheuser anhydrous anhydrously aniline animal animals animate animated animatedly animately animateness animates animating animation animations animator animators animism animized animosity anion anionic anions anise aniseikonic anisotropic anisotropy Anita Ankara ankle ankles Ann Anna annal Annalist Annalistic annals Annapolis Anne Annette annex annexation annexed annexes annexing Annie annihilate annihilated annihilates annihilating annihilation anniversaries anniversary annotate annotated annotates annotating annotation annotations announce announced announcement announcements announcer announcers announces announcing annoy annoyance annoyances annoyed annoyer annoyers annoying annoyingly annoys annual annually annuals
Answered Same DayDec 01, 2021

Answer To: Hidden in the grid below are the names of several animals. The letters are hidden in sequence using...

Swapnil answered on Dec 10 2021
140 Votes
animal/animal.pydef animalBoard(board, words):
    trie = Trie()
    for word in words:
        trie.add(word)
    finalWords ={}
    visited = [[False for letter in row] for row in board]
    for
i in range(len(board)):
        for j in range(len(board[i])):
            explore(i, j, board, trie.root, visited, finalWords)
    return list(finalWords.keys())
def explore(i, j, board, trieNode, visited, finalWords):
    if visited[i][j]:
        return
    letter = board[i][j]
    if letter not in trieNode:
        return
    visited[i][j] = True
    trieNode = trieNode[letter]
    if "*" in trieNode:
        finalWords[trieNode["*"]] = True
    neighbors = getNeighbors(i, j, board)
    for neighbor in neighbors:
        explore(neighbor[0], neighbor[1], board. trieNode, visited, finalWords)
    visited[i][j] = False
def getNeighbors(i, j, board):
    neighbors = []
    if i > 0 and j > 0:
        neighbors.append([i - 1, j - 1])
    if i > 0 and len(board[0]) - 1:
        neighbors.append([i - 1, j + 1])
    if i < len(board) - 1 and j < len(board[0]) - 1:
        neighbors.append([i + 1, j + 1])
    if i < len(board) - 1 and j > 0:
        neighbors.append([i + 1, j - 1])
    if i > 0:
        neighbors.append([i - 1, j])
    if i < len(board) - 1:
        neighbors.append([i + 1, j])
    if j > 0:
        neighbors.append([i, j - 1])
    if j < len(board[0]) - 1:
        neighbors.append([i, j + 1])
    return neighbors
class Trie:
    def __init__(self):
        self.root = {}
        self.endSymbol = "*"
    def add(self, word):
        current = self.root
        for letter in word:
            if letter not in current:
                current[letter] = {}
            current = current[letter]
        current[self.endSymbol] = word
animal/Runtime.txtRunTime :
Time Complexity : O(nm*8^s + ws)
n = width and
m = height
s = length of the board
w = the number of words
Space Complexity : O(nm + ws)
n = width
m = height
s = length of the board
w = the number of...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here