Deque

dequeue

  • ํ 2๊ฐœ๋ฅผ ๊ฒน์ณ๋†“์€ ๊ฒƒ๊ณผ ๊ฐ™๋‹ค. (= double ended queue = dequeue)

  • ์–‘์ชฝ์—์„œ ๋ฐ์ดํ„ฐ์˜ ์ž…์ถœ๋ ฅ์ด ๋ชจ๋‘ ๊ฐ€๋Šฅํ•œ ์ž๋ฃŒ๊ตฌ์กฐ

  • ์—ฐ์†์ ์ธ ๋ฉ”๋ชจ๋ฆฌ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•˜๋Š” ์‹œํ€€์Šค ์ปจํ…Œ์ด๋„ˆ

  • ์„ ์–ธ ์ดํ›„ ํฌ๊ธฐ๋ฅผ ์ค„์ด๊ฑฐ๋‚˜ ๋Š˜๋ฆด ์ˆ˜ ์žˆ๋Š” ๊ฐ€๋ณ€์  ํฌ๊ธฐ๋ฅผ ๊ฐ–์Œ

  • ์Šคํƒ๊ณผ ํ์˜ ํŠน์„ฑ์„ ๋ชจ๋‘ ์ง€๋‹ˆ๊ณ  ์žˆ์–ด์„œ ๋‘˜ ๋‹ค๋กœ๋„ ํ™œ์šฉ๊ฐ€๋Šฅํ•˜๋‹ค.

  • ๊ตฌํ˜„ ๋ฉ”์†Œ๋“œ

    • addFirst

    • offerFirst

    • addLast/add

    • offerLast

    • removeFirst

    • pollFirst

    • removeLast

    • pollLast

    • remove

    • poll

    • getFirst

    • peekFirst

    • getLast

    • peekLast

    • peek

    • removeFirstOccurrence

    • removeLastOccurrence

    • element

    • addAll

    • push

    • pop

    • remove

    • contain

    • size

  • ์Šคํƒ๊ณผ ํ์™€ ์ฐจ์ด์ 

    • ์Šคํƒ, ํ

      • rear ๊ฐ€ ๋‹ค์Œ ์š”์†Œ๊ฐ€ ์‚ฝ์ž…๋  ์œ„์น˜๋ฅผ ๊ฐ€๋ฆฌํ‚จ๋‹ค.

      • ์•ž, ๋’ค๋กœ๋งŒ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•˜๋‹ค.

    • ๋ฑ

      • rear๊ฐ€ ๋งˆ์ง€๋ง‰ ์š”์†Œ ์ž์ฒด๋ฅผ ๊ฐ€๋ฆฌํ‚จ๋‹ค.

      • index ๋ฅผ ์ด์šฉํ•ด์„œ ์ค‘๊ฐ„ ์ ‘๊ทผ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

  • ์‹œ๊ฐ„๋ณต์žก๋„

    • ์‚ฝ์ž…๊ณผ ์‚ญ์ œ์— O(1)

  • ๊ตฌํ˜„

    • ์–‘๋ฐฉํ–ฅ ์—ฐ๊ฒฐ ๋ฆฌ์ŠคํŠธ

์ฐธ๊ณ 

Last updated