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
| /* | |
| * @author Adrian Statescu <mergesortv@gmail.com> | |
| * MIT Style License | |
| */ | |
| var Node = new Class({ | |
| initialize: function(info) { | |
| this.info = info; | |
| this.left = null; | |
| this.right = 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
| ''' | |
| In computer science, a binary search algorith finds the position of a specified input key within a sorted vector | |
| by Adrian Statescu <adrian@thinkphp.ro> | |
| MIT Style License | |
| ''' | |
| def binarySearch(what,arr): | |
| li = 0 | |
| ls = len(arr)-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
| <?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> | |
| 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
| /** | |
| * 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 | |
| */ | |
| 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
| #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
| 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
| ''' | |
| 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
| ''' | |
| Postfix math evaluator | |
| See: http://en.wikipedia.org/wiki/Reverse_Polish_notation | |
| by Adrian Statescu <mergesortv@gmail.com> | |
| MIT Style License | |
| ''' | |
| import re | |
| operators = {'+': lambda x,y: x+y, | |
| '*': lambda x,y: x*y, |