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