This file contains 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
void Permutation(char* pStr, char* pBegin); | |
///////////////////////////////////////////////////////////////////////// | |
// Get the permutation of a string, | |
// for example, input string abc, its permutation is | |
// abc acb bac bca cba cab | |
///////////////////////////////////////////////////////////////////////// | |
void Permutation(char* pStr) | |
{ | |
Permutation(pStr, pStr); |
This file contains 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 perm(s = [], beg = 0, end = 0): | |
if (len (s) == 0): | |
return; | |
if ( beg == end ): | |
print s | |
else: | |
for i in xrange(beg, end): | |
temp = s[i] | |
s[i] = s[beg] |
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf8 -*- | |
import collections | |
import math | |
import sys | |
import getopt | |
import re | |
def suffix(s, i): |
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf8 -*- | |
import threading | |
import time | |
import random | |
sema = threading.Semaphore(2) | |
class Grab(threading.Thread): |
This file contains 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
/* | |
* Licensed to the Apache Software Foundation (ASF) under one | |
* or more contributor license agreements. See the NOTICE file | |
* distributed with this work for additional information | |
* regarding copyright ownership. The ASF licenses this file | |
* to you under the Apache License, Version 2.0 (the | |
* "License"); you may not use this file except in compliance | |
* with the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |
This file contains 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
/* | |
* Licensed to the Apache Software Foundation (ASF) under one or more | |
* contributor license agreements. See the NOTICE file distributed with | |
* this work for additional information regarding copyright ownership. | |
* The ASF licenses this file to You under the Apache License, Version 2.0 | |
* (the "License"); you may not use this file except in compliance with | |
* the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* |
This file contains 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
import static org.opencv.core.CvType.CV_8U; | |
import static org.opencv.imgcodecs.Imgcodecs.IMREAD_COLOR; | |
import static org.opencv.imgproc.Imgproc.CHAIN_APPROX_SIMPLE; | |
import static org.opencv.imgproc.Imgproc.LINE_AA; | |
import static org.opencv.imgproc.Imgproc.RETR_TREE; | |
import static org.opencv.imgproc.Imgproc.THRESH_BINARY; | |
import static org.opencv.imgproc.Imgproc.fillConvexPoly; | |
import static org.opencv.imgproc.Imgproc.findContours; | |
import java.net.URL; |