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
| ''' | |
| Calculate the value of PI using Infinite Series | |
| Twitter: @thinkphp | |
| Website: http://thinkphp.ro | |
| G+ : http://gplus.to/thinkphp | |
| MIT Style License | |
| 4*(1- 1/3 + 1/5 - 1/7 + 1/9 +...) | |
| ''' | |
| import math |
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
| ''' | |
| Twitter: @thinkphp | |
| Website: http://thinkphp.ro | |
| G+ : http://gplus.to/thinkphp | |
| MIT Style License | |
| input.txt: | |
| 2 4 6 8 0 0 0 0 0 | |
| 3 5 7 9 0 0 0 0 0 | |
| || |
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 Node: | |
| def __init__(self, info, left=None,right=None): | |
| self.info = info | |
| self.left = left | |
| self.right = right | |
| def __call__(self, left=None, right=None): | |
| self.left = left | |
| self.right = right | |
| return self.info |
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
| #defines a linked list iterator for the list | |
| class NodeIterator: | |
| def __init__(self,listHead): | |
| self._currNode = listHead | |
| def __iter__(self): | |
| return self | |
| def next(self): | |
| if self._currNode is None: |
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
| /** | |
| * by Adrian Statescu <adrian@thinkphp.ro> | |
| * Twitter: @thinkphp | |
| * G+ : http://gplus.to/thinkphp | |
| * MIT Style License | |
| */ | |
| function Node(info){ | |
| this.info = info | |
| this.left = null; |
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
| /** | |
| * by Adrian Statescu <adrian@thinkphp.ro> | |
| * Twitter: @thinkphp | |
| * G+ : http://gplus.to/thinkphp | |
| * MIT Style License | |
| */ | |
| var Node = new Class({ | |
| initialize: function(info) { |
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
| ''' | |
| by Adrian Statescu <adrian@thinkphp.ro> | |
| Twitter: @thinkphp | |
| G+ : http://gplus.to/thinkphp | |
| MIT Style License | |
| ''' | |
| ''' | |
| Binary Search Tree | |
| ------------------ |
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
| <?php | |
| /** | |
| * by Adrian Statescu <adrian@thinkphp.ro> | |
| * Twitter: @thinkphp | |
| * G+ : http://gplus.to/thinkphp | |
| * MIT Style License | |
| */ |
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
| ''' | |
| by Adrian Statescu <adrian@thinkphp.ro> | |
| MIT Style License | |
| ''' | |
| def merge(arrA,arrB): | |
| arrC = [] | |
| i = 0 | |
| j = 0 | |
| n = len(arrA)-1 | |
| m = len(arrB)-1 |
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
| #inherit.py | |
| class SchoolMember: | |
| '''Represents any school member''' | |
| def __init__(self, name, age): | |
| self.name = name | |
| self.age = age | |
| print 'Initialized SchoolMember constructor: %s' % self.name |