おうちでKMP法

Db03b4d80c8c825d9f39290fe0b7d798?s=47 akht
April 24, 2020
87

 おうちでKMP法

Db03b4d80c8c825d9f39290fe0b7d798?s=128

akht

April 24, 2020
Tweet

Transcript

  1. 4UBZ)PNF ஑ాতਔ(.01FQBCP *OD ࣛࣇౡNL ͓͏ͪͰ,.1๏

  2. ΤϯδχΞ ஑ాতਔ!BLIU@JLE $50ࣨࣛࣇౡΦϑΟενʔϜ BLIUJLEDPN

  3. "#$ͷதʹ#͸ؚ·Ε͍ͯ·͔͢ʁ 2

  4. "#$ͷதʹ#͸ؚ·Ε͍ͯ·͔͢ʁ " ౴͑ɿ:FT "#$

  5. ""#"##"#"#$"# ͷதʹ "#"#$" ͸ؚ·Ε͍ͯ·͔͢ʁ 2

  6. " ౴͑ɿ:FT ""#"##"#"#$"# ""#"##"#"#$"# ͷதʹ "#"#$" ͸ؚ·Ε͍ͯ·͔͢ʁ

  7. ""#"##"#$"$"# ͷதʹ "#"#$" ͸ؚ·Ε͍ͯ·͔͢ʁ 2

  8. " ౴͑ɿ/P ""#"##"#$"$"# ""#"##"#$"$"# ͷதʹ "#"#$" ͸ؚ·Ε͍ͯ·͔͢ʁ

  9. ͜ΕΛ൑ఆ͢Δ͜ͱΛߟ͑Δ จࣈྻQBUUFSO͕ɺݕࡧର৅จࣈྻUFYUͷ ͲͷҐஔʹଘࡏ͢Δ͔Λݟ͚ͭΔ

  10. ํ๏ɿྗ·͔ͤ๏

  11. ྗ·͔ͤ๏ A A B A B B A B A

    B C A B A B A B C A A B A B C A A B A B C A A B A B C A A B A B C A A B A B C A A B A B C A 5FYU 1BUUFSO ! ! ! ! ! ! "" ❌ ❌ ❌ ❌ ❌ ❌
  12. ྗ·͔ͤ๏ wૉ๿ͳํ๏ w UFYU ""#"##"#"#$"# ͱQBUUFSO "#"#$" ͷઌ಄͔Βจࣈͣͭൺֱ w QBUUFSOͷશͯʹҰகͨ͠ΒऴྃɺෆҰக͕֬ఆͨ͠Βଧͪ੾ͬͯUFYUͷ࣍ͷҐஔ͔Βൺ

    ֱΛ։࢝ w UFYUͷจࣈྻ௕ºQBUUFSOͷจࣈྻ௕ ճͷൺֱ͕ඞཁ ࠷ѱ  w࠷ѱܭࢉྔɿ0 /.  wΘ͔Γ΍͍͚͢Ͳखॱʹ͸ແବ͕͋Δʢແବͱ͸ʁ‎ʣ
  13. ྗ·͔ͤ๏ A A B A B B A B A

    B C A B A B A B C A A B A B C A ˢ͜͜ͰෆҰகͩͬͨͱ͖ A B A B C A ˢUFYUͷ։࢝ҐஔΛจࣈͣΒͯ͠ ɹ·ͨQBUUFSOͷઌ಄͔ΒൺֱΛ࠶։͢Δͷ͸ແବͰ͸ʁ ɹUFYUͷΠϯσοΫε͕ޙ໭Γͯ͠͠·ͬͯΔ ˢઌ಄ͷ"#͕Ϛον͢Δͷ͸Θ͔Γ͖ͬͯΔΜ͔ͩΒ ɹ͔͜͜ΒൺֱΛ࠶։ͨ͠Β͍͍͡ΌΜ‎,.1๏ ❌
  14. ํ๏ɿ,.1๏ ΫψʔεrϞϦεrϓϥοτ๏ʢ,OVUIr.PSSJTr1SBUUBMHPSJUIN

  15. ,.1๏ wจࣈҐஔΛεΩοϓͯ͠ແବΛল͘ wQBUUFSOจࣈྻ͔ΒͣΒ͠දͱ͍͏΋ͷΛ࡞Δ wUFYUͱQBUUFSOͷෆҰக͕ى͖ͨͱ͖ɺ࣍ʹQBUUFSOจࣈྻͷͲͷҐ ஔ͔ΒൺֱΛ࠶։͢Δ͔ΛͣΒ͠දΛΈܾͯΊΔ wUFYUͷΠϯσοΫε͸ޙ໭Γͤ͞ͳ͍ A B A B

    C A 0 0 1 2 0 1
  16. ,.1๏ A A B A B B A B A

    B C A B A B A B C A ˢ͜͜ͰෆҰகͩͬͨͱ͖ͣΒ͠දΛΈΔ ͻͱͭલͷ#ͷ਺ࣈΛݟΔ A B A B C A ˢͣΒ͠ද͕ͳͷͰΠϯσοΫε͕ͷҐஔ͔Βൺֱ࠶։ ɹ͜ͷ࣌ɺUFYUͷΠϯσοΫε͸ޙ໭Γͯ͠ͳ͍ʂ A B A B C A 0 0 1 2 0 1 ❌
  17. ,.1๏ A A B A B B A B A

    B C A B A B A B C A A B A B C A A B A B C A A B A B C A 5FYU 1BUUFSO ! ! ! "" ❌ ❌ ❌ A B A B C A 0 0 1 2 0 1
  18. ྗ·͔ͤ๏ ൺֱ༻ A A B A B B A B

    A B C A B A B A B C A A B A B C A A B A B C A A B A B C A A B A B C A A B A B C A A B A B C A 5FYU 1BUUFSO ! ! ! ! ! ! "" ❌ ❌ ❌ ❌ ❌ ❌
  19. ,.1๏ wQBUUFSOจࣈྻͷͣΒ͠දͱ͸ͳΜͳͷ͔ʁ wͦͷจࣈ࣌఺Ͱɺ௚લͷαϒจࣈྻ͕ઌ಄͔ΒͷαϒจࣈྻͱҰக͢ Δ௕͞ wཁ͢Δʹɺ͢Ͱʹग़͖ͯͨ΋ͷ͔Ͳ͏͔Λه࿥͓ͯ͘͠ w࠷ѱܭࢉྔɿ0 / . ʢ/දߏங .UFYUͷ௕͞ʣ

    A B A B C A 0 0 1 2 0 1
  20. ͣΒ͠දͷ࡞੒ ݕࡧ

  21. ޮ཰Α͘Ͱ͖ͯΊͰͨ͠ʂ Ͱ͸ͳ͍

  22. ࣮༻্ͷ࿩ wྗ·͔ͤ๏ɿ0 /. ɺ,.1๏ɿ0 / . ͱ͍͏ͷ͸࠷ѱέʔεͷ࿩ wྗ·͔ͤ๏͕஗͍ͷ͸ዞҙతͳέʔε wUFYUBBBBBBBBBBBBBBBBBBBBBBC QBUUFSOBBBBBBCΈ͍ͨͳ

    wQBUUFSOͷ࠷ޙ·Ͱݟͳ͍ͱ൑அͰ͖ͳ͍Α͏ͳ΋ͷ w࣮༻্͸࠷ॳͷ਺จࣈͰෆҰகʹͳΔͷͰ0 / ͱΈͳͤΔ wͭ·Γ࣮༻্͸ྗ·͔ͤ๏ͷ΄͏͕଎͍ ,.1๏͸ཧ࿦తʹॏཁ
  23. จࣈྻݕࡧΞϧΰϦζϜ wྗ·͔ͤ๏ɺ,.1๏Ҏ֎ʹ΋৭ʑ͋Δ w#.๏ʢϘΠϠʔϜʔΞ๏ʣཧ࿦తʹ΋࣮༻తʹ΋༏ΕΔ wΤΠϗrίϥγοΫ๏ wϥϏϯΧʔϓ๏ wͳͲ w࣍ճ͸#.๏ʹ͍ͭͯ࿩͠·͢ʂ̍