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
- intellij
- android
- Kotlin
- git
- go
- Linux
- github
- war
- ubuntu
- Gradle
- ios
- golang
- Spring
- SWIFT
- CentOS
- Xcode
- Python
- centos8
- enum
- windows10
- rxswift
- Windows
- nodejs
- docker
- cocoapods
- tomcat
- MySQL
- Codable
- php
- Java
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함