Skip to content

Commit

Permalink
[Queue] Fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
deunlee committed May 25, 2020
1 parent 3e22ecc commit 3b75154
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Queue/Queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace Deun {
return count;
}

// front : 원소를 삭제할 자리 (채워져 있는 상태, 단, count가 0이면 비워져 있음)
// rear : 원소를 삽입할 자리 (비어있는 상태)
// front : 원소를 삭제할 자리 (채워진 상태) (단, count가 0이면 비워져 있음)
// rear : 원소를 삽입할 자리 (비어있는 상태) (단, count가 size면 채워져 있음)

bool Queue::enqueue(int element) {
if (isFull()) {
Expand Down
16 changes: 8 additions & 8 deletions Queue/Queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ namespace Deun {
private:
int* elements;
unsigned int size; // 큐의 크기 (배열 원소의 개수)
unsigned int count; // 채워진 데이터의 개수
unsigned int count; // 채워진 원소의 개수
// (count 변수를 사용하지 않아도 큐의 공백/포화 상태를
// 검출할 수 있지만, 배열의 원소 중 하나를 비워두어야 한다.
// 이것이 별로 마음에 들지 않아 count 변수를 사용하기로 하였다.)
// 검출할 수 있지만, 배열의 원소 중 하나를 비워두어야 한다)
// (비워두는 것이 마음에 들지 않아 count 변수를 사용하기로 )
unsigned int front; // 원소를 삭제할 자리
unsigned int rear; // 원소를 삽입할 자리

Expand All @@ -28,12 +28,12 @@ namespace Deun {
bool isEmpty();
bool isFull();

unsigned int getSize();
unsigned int getCount();
unsigned int getSize(); // 전체 크기 반환
unsigned int getCount(); // 채워진 원소의 개수 반환

bool enqueue(int element); // 맨 뒤에 삽입 (성공시 true, 실패시 false)
int dequeue(); // 맨 앞 원소 반환 및 삭제 (실패시 throw)
int peek(); // 맨 앞 원소 반환 (실패시 throw)
bool enqueue(int element); // 맨 뒤에 원소 삽입 (성공 = true, 실패 = false)
int dequeue(); // 맨 앞 원소 반환 및 삭제 (실패 = throw)
int peek(); // 맨 앞 원소 반환 (실패 = throw)
};
}

Expand Down

0 comments on commit 3b75154

Please sign in to comment.