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
stack1 = [] | |
stack2 = [] | |
def enqueuue(a): | |
stack1.append(a) | |
def dequeue(): | |
if len(stack2) > 0: | |
return stack2.pop() | |
elif len(stack2) == 0 and len(stack1) > 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
def braces_validator(string): | |
openers = "({[" | |
closers = ")}]" | |
stack = [] | |
for char in string: | |
if char in openers: | |
stack.append(openers.index(char)) | |
elif char in closers: | |
if len(stack) == 0 or stack.pop() != closers.index(char): | |
return False |
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
openers = "({[" | |
closers = ")}]" | |
def paranthesis_match(string, pos): | |
stack = [string[pos]] | |
for i in range(pos + 1, len(string)): | |
if string[i] in openers: | |
stack.append(string[i]) | |
if string[i] in closers: | |
stack.pop() |
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
for file in `find . -type f -name "*.jpg"` | |
do | |
thumbnail_file="./thumbnail/${file##*/}" | |
if [ ! -e "${file%/*}/thumbnail" ]; then mkdir -p "${file%/*}/${thumbnail_dir}"; fi | |
echo "Create thumbnail for image $file" | |
`convert -thumbnail x300 $file $thumbnail_file` | |
done |
OlderNewer