Skip to content

Stack 2개로 Queue 구현하기 #6

Open

Description

@voidmatcha

WIP

Activity

  1. self-assigned this
    on Mar 11, 2021
  2. voidmatcha commented on Mar 11, 2021

    @voidmatcha
    MemberAuthor

    장점

    JavaScript의 경우 list에서 shift 메서드로 dequeue처럼 사용할 수 있다. 이 경우 O(N)의 시간복잡도를 가진다.

    만약 list를 Stack처럼 2개를 사용하여 Queue를 구현하게 되면 dequeue할 때 O(1)의 시간복잡도일 것이다. 이것이 장점 중 하나라고 유추했다.

    아직 정확한건 모르겠다. 면접에서 어떻게 대답해야할까?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions