This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| def show_user_prompt(msg) | |
| puts msg | |
| # flush our message to display | |
| STDOUT.flush | |
| return STDIN.gets.chomp | |
| end | |
| def get_user_input |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Queue(object): | |
| def __init__(self): | |
| self.stack1 = Stack() | |
| self.stack2 = Stack() | |
| def enqueue(self,p): | |
| self.stack1.push(p) | |
| def dequeue(self): | |
| #pop off all in 1 onto 2 |
NewerOlder