| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 개발
- DP
- 북리뷰
- 코테
- 정석
- 컴퓨터공학과
- coding
- vector
- 그래프
- 오에스
- 브루트포스
- 컴공
- 알고리즘
- Operating System
- c++
- 너비우선탐색
- 스택
- Computer science
- 자료구조
- 구현
- 백준
- Stack
- 정석학술정보관
- 컴공과
- 코딩
- bfs
- cs
- OS
- 오퍼레이팅시스템
- 문제풀이
- Today
- Total
목록queue (2)
Little Jay
#include #include using namespace std; class Node { public: int data; Node* next; Node(int data) { this->data = data; this->next = NULL; } }; class LinkedList { public: Node* f; Node* r; LinkedList() { f = NULL; r = NULL; } ~LinkedList() { } int front() { return f->data; } int end() { return r->data; } void addBack(int data) { Node* n = new Node(data); if (f == NULL) { f = r = n; } else { r->nex..
처음에 이 문제를 봤을때 진짜 queue만 써서 구하는 문제는 아니겠지...?라는 마음으로 접근했는데, queue 자체의 기능을 써도 되는 것 같고, 구조체를 써도 되는 것 같았다. 하지만 구조체를 하직 배우지 않아서 queue를 사용하는 방향으로 문제를 풀었다. #include #include #include using namespace std; int main() { ios::sync_with_stdio(false); int testCase; cin >> testCase; queue q; for (int i = 0; i > s; if (s == "push") { int n; cin >> n; q.push(n); } else if (s == ..