Created
January 6, 2016 20:58
-
-
Save ozgurkaracam/ffb7befd123f8801807f to your computer and use it in GitHub Desktop.
aynı yığıt kontrolü özyineli
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 Stack: | |
def __init__(self): | |
self.alist=[] | |
def pop(self): | |
return self.alist.pop() | |
def push(self,a): | |
self.alist.append(a) | |
def show(self): | |
return self.alist | |
def peek(self): | |
return self.alist[len(self.alist)-1] | |
def isempty(self): | |
return len(self.alist)==0 | |
def size(self): | |
return len(self.alist) | |
def yigitaynimi(a,b): | |
if a.isempty and b.isempty(): | |
return True | |
else: | |
if a.isempty() or b.isempty(): | |
return False | |
else: | |
if a.pop()!=b.pop(): | |
return False | |
else: | |
return yigitaynimi(a,b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment