Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p.259 원형 큐 디자인 Design Circular Queue 질문 #105

Open
DoTheBestMayB opened this issue May 11, 2021 · 1 comment
Open

p.259 원형 큐 디자인 Design Circular Queue 질문 #105

DoTheBestMayB opened this issue May 11, 2021 · 1 comment

Comments

@DoTheBestMayB
Copy link

DoTheBestMayB commented May 11, 2021

p. 263 답안에서

isEmpty 와 isFull 함수에서 self.p1 == self.p2 는 없어도 되지 않나요?

isEmpty 인지는 front 포인터가 None 인지, isFull 인지는 end가 not None 인지만 확인하면 되므로
아래 코드처럼 간단하게 표현할 수 있다고 생각해요

def isEmpty(self) -> bool:
   return self.q[self.p1] is None

def isFull(self) -> bool:
    return self.q[self.p2] is not None
@likejazz
Copy link
Collaborator

likejazz commented Jul 5, 2021

네, 그렇네요. 굳이 불필요한 부분을 좀 더 제거할 수 있을 것 같습니다. 알려주셔서 감사합니다. 이 곳에 반영하도록 하겠습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants