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 partition(a, p, q): | |
| pivot = a[q-1] | |
| i = p-1 | |
| for j in range(p, q-1): | |
| if a[j] < pivot: | |
| i += 1 | |
| t = a[j] | |
| a[j] = a[i] | |
| a[i] = t |
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
| #!/usr/bin/python | |
| import sys | |
| import os | |
| if len(sys.argv) < 2: | |
| sys.exit('Error! you must give root directory (rel to this dir)') | |
| src_cpp = [] | |
| src_mm = [] |
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
| #!/usr/bin/python | |
| import os | |
| import string | |
| i = 0 | |
| for dirname, dirnames, filenames in os.walk('days'): | |
| # for subdirname in dirnames: | |
| # print os.path.join(dirname, subdirname) |
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
| #include <iostream> | |
| #include <list> | |
| using namespace std; | |
| void merge(int* arr, int p, int q, int r) | |
| { | |
| list<int> l1(arr + p, arr + q + 1); | |
| list<int> l2(arr + q + 1, arr + r + 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
| #include <iostream> | |
| using namespace std; | |
| int main() | |
| { | |
| int arr[] = {12, 6, 17, 8, 97, 123, 21, 12, 5, 945, 32, 343}; | |
| for (int i = 1; i < _countof(arr); ++i) | |
| { | |
| int key = arr[i]; | |
| int j = i - 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
| #include <fstream> | |
| #include <string> | |
| #include <boost/thread.hpp> | |
| class Writer | |
| { | |
| public: | |
| Writer(const char* out_filename) | |
| : m_out_filename(out_filename) |
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
| #include <fstream> | |
| #include "writer.h" | |
| class WriterManager | |
| { | |
| public: | |
| void Run() | |
| { | |
| std::unique_ptr<Writer> wp(new Writer("out.txt")); |