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
([-\r\n\w\s\[\](){}=!\/%*+&^|."']*)\?([-\r\n\w\s\[\](){}=!\/%*+&^|."']*)([\w]+)([-\r\n\w\s\[\](){}=!\/%*+&^|."']*):([-\r\n\w\s\[\](){}=!\/%*+&^|."']*) |
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
function Algorithm(name, listOSortables){ | |
this.name = name; | |
this.sortables = listOSortables; | |
this.unsortables = {}; | |
this.addSortable = function(name, sortable) { | |
this.sortables[name] = sortable; | |
return this; | |
}; | |
this.addUnsortable = function(name, contents) { | |
this.unsortables[name] = contents; |
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
''' | |
params: myNode - Node object; Must not be member of Circular LL | |
alters: Any List container 'pointing' indirectly to myNode | |
* Removes all objects enroute to end of List that hold same contents values | |
returns: None | |
''' | |
def removeDuplicates(myNode): | |
tempNode = myNode | |
while tempNode.getNext() != None: | |
toRemove = tempNode.getNext() |
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, data): | |
self.contents = data | |
self.next = None | |
def getContents(self): | |
return self.contents | |
def getNext(self): | |
return self.next |
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
def revWordList(input): | |
return ' '.join(reversed(input.split(' '))) | |
print(revWordList("world! Hello,")) |
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
def revStrLoop(input): | |
outList = [0]*len(input) | |
for i, char in enumerate(input): | |
outList[len(input)-i-1] = char | |
return ''.join(outList) | |
def revStrList(input): | |
return ''.join(reversed(list(input))) | |
def revStrSlice(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
from collections import defaultdict | |
def charCount(inStr): | |
charDict = defaultdict(int) | |
for char in inStr: | |
charDict[char] += 1 | |
return charDict | |
def isPermutation(leftStr, rightStr): | |
return charCount(leftStr) == charCount(rightStr) |