Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Double-Array Search

jojonki
November 19, 2019

Double-Array Search

jojonki

November 19, 2019
Tweet

More Decks by jojonki

Other Decks in Technology

Transcript

  1. 3 3 -1 3 -1 0 0 1 5 1

    4 0 base check index 1 2 5 4 6 3 จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc ݕࡧͯ͠ΈΑ͏ʂ 6 -1 7 7 5
  2. 3 3 -1 3 -1 0 0 1 5 1

    4 0 base check index 1 2 5 4 6 3 จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc base[1]͔Βελʔτʂ “a#”Λݕࡧʂ 6 -1 7 7 5
  3. 3 3 -1 3 -1 0 0 1 5 1

    4 0 base check index 1 2 5 4 6 3 base[1]+code(a)=4 index 4ʹҠಈ จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “a#”Λݕࡧʂ 6 -1 7 7 5
  4. 3 3 -1 3 -1 0 0 1 5 1

    4 0 base check index 1 2 5 4 6 3 check[4] == ભҠݩindex? OK! ભҠՄೳ จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “a#”Λݕࡧʂ 6 -1 7 7 5
  5. 3 3 -1 3 -1 0 0 1 5 1

    4 0 base check index 1 2 5 4 6 3 base[4]+code(#)=3 index 3ʹҠಈ จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “a#”Λݕࡧʂ 6 -1 7 7 5
  6. 3 3 -1 3 -1 0 0 1 5 1

    4 0 base check index 1 2 5 4 6 3 check[3] == ભҠݩindex? OK! ભҠՄೳ จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “a#”Λݕࡧʂ 6 -1 7 7 5
  7. 3 3 -1 3 -1 0 0 1 5 1

    4 0 base check index 1 2 5 4 6 3 base஋͕-1͸ऴ୺ Αͬͯޠኮa͸ొ࿥͞Ε͍ͯΔʂ จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “a#”Λݕࡧʂ 6 -1 7 7 5
  8. 3 3 -1 3 -1 0 0 1 5 1

    4 0 base check index 1 2 5 4 6 3 จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “bc#”Λݕࡧʂ base[1]+code(b)=5 index 5ʹҠಈ 6 -1 7 7 5
  9. 3 3 -1 3 -1 0 0 1 5 1

    4 0 base check index 1 2 5 4 6 3 check[5] == ભҠݩindex? OK! ભҠՄೳ จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “bc#”Λݕࡧʂ 6 -1 7 7 5
  10. 3 3 -1 3 -1 0 0 1 5 1

    4 0 base check index 1 2 5 4 6 3 จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “bc#”Λݕࡧʂ base[5]+code(c)=6 index 6ʹҠಈ 6 -1 7 7 5
  11. 7 5 3 3 3 -1 0 0 1 5

    1 4 0 base check index 1 2 5 4 6 3 check[6] == ભҠݩindex? OK! ભҠՄೳ จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “bc#”Λݕࡧʂ 6 -1 7
  12. 3 3 -1 3 -1 0 0 1 5 1

    4 0 base check index 1 2 5 4 6 3 base[6]+code(#)=7 index 7ʹҠಈ จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “bc#”Λݕࡧʂ 6 -1 7 7 5
  13. 7 5 3 3 3 -1 0 0 1 5

    1 4 0 base check index 1 2 5 4 6 3 check[7] == ભҠݩindex? OK! ભҠՄೳ จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “bc#”Λݕࡧʂ 6 -1 7
  14. 7 5 3 3 3 -1 0 0 1 5

    1 4 0 base check index 1 2 5 4 6 3 จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “bc#”Λݕࡧʂ 6 -1 7 base஋͕-1͸ऴ୺ Αͬͯޠኮbc͸ొ࿥͞Ε͍ͯΔʂ
  15. 3 3 -1 3 -1 0 0 1 5 1

    4 0 base check index 1 2 5 4 6 3 จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “c”Λݕࡧʂ base[1]+code(c)=6 index 6ʹҠಈ 6 -1 7 7 5
  16. 3 3 -1 3 -1 0 0 1 5 1

    4 0 base check index 1 2 5 4 6 3 check[6] == ભҠݩindex? NO! “c”͸ભҠෆՄ จࣈίʔυ஋ #: 0 a: 1 b: 2 c: 3 ޠኮࣙॻ a bc “c”Λݕࡧʂ 6 -1 7 7 5