Double-Array Search

Ed4015bc3fe175aff40fb1def164df8f?s=47 jojonki
November 19, 2019

Double-Array Search

Ed4015bc3fe175aff40fb1def164df8f?s=128

jojonki

November 19, 2019
Tweet

Transcript

  1. 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. 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 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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