| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- 컴공과
- 정석
- 오에스
- 코테
- 컴퓨터공학과
- 컴공
- 코딩
- 북리뷰
- coding
- 개발
- 그래프
- c++
- 정석학술정보관
- 구현
- vector
- 백준
- DP
- bfs
- Operating System
- cs
- 자료구조
- 브루트포스
- 오퍼레이팅시스템
- 스택
- 너비우선탐색
- Computer science
- 알고리즘
- 문제풀이
- OS
- Stack
- 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 == ..