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 <algorithm> | |
| #include <iostream> | |
| #include <valarray> | |
| #include <vector> | |
| template<typename T> | |
| std::ostream& operator<< (std::ostream& os, std::valarray<T> va) | |
| { | |
| for (auto&& i : va) | |
| os << i << " "; |
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
| // Compile with g++ -O2 -std=c++0x sho_test.cc -o sho_test | |
| // or (gnu gcc 4.7 or above) | |
| // Compile with g++ -O2 -std=c++11 sho_test.cc -o sho_test | |
| // This package finds the ground state of the Simple Harmonic Oscillator | |
| // with a test function \frac{\sqrt\alpha}{\pi^{\frac{1}{4}}} \exp( - \frac{1}{2} x^2\alpha^2) | |
| #include <cmath> | |
| #include <iomanip> | |
| #include <iostream> |
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 <cstdio> | |
| #include <exception> | |
| #include <iostream> | |
| #include <sstream> | |
| #include <string> | |
| // 1234-------- | |
| template<typename T> | |
| class Stack |
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> | |
| int cycle_lenght (int i) | |
| { | |
| int lenght = 1; | |
| int n = i; | |
| while (n != 1) | |
| { | |
| n = n % 2 == 0? n / 2 : 3 * n + 1; | |
| lenght++; |
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 <exception> | |
| #include <stdexcept> | |
| #include <functional> | |
| #include <string> | |
| // 1234-------- | |
| template<typename T> | |
| class QeueArray |
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 <exception> | |
| #include <functional> | |
| #include <iostream> | |
| #include <stdexcept> | |
| #include <string> | |
| template<typename T> | |
| class DEQeue | |
| { | |
| public: |
NewerOlder