Stack을 이용하여 Queue 만들기
import Foundation class Stack { private var list = [String]() func push(item: String) { list.append(item) } func pop() -> String? { return list.popLast() } var isEmpty: Bool { return list.isEmpty } } class Queue { private var inBox = Stack() private var outBox = Stack() private let lock = NSLock() func enQueue(item: String) { lock.lock() inBox.push(item: item) lock.unlock() } func deQueue() -> S..
Coding
2019. 11. 21. 17:47
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- SWIFT
- Codable
- go
- tomcat
- Gradle
- cocoapods
- docker
- golang
- war
- Linux
- windows10
- CentOS
- Kotlin
- github
- nodejs
- Java
- Xcode
- Windows
- centos8
- rxswift
- Python
- MySQL
- intellij
- android
- Spring
- git
- ubuntu
- php
- enum
- ios
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함