Last active
January 3, 2019 18:22
-
-
Save scriptnull/cae9896a54566923b43facd51b2bbf26 to your computer and use it in GitHub Desktop.
My C++ utility code
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
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
#include <stack> | |
#include <assert.h> | |
#include <queue> | |
using namespace std; | |
namespace util { | |
// Print a message and vector contents | |
template<typename T> | |
void print_vec(std::string message, std::vector<T> & vec) { | |
std::cout << message << " -> "; | |
for (auto item : vec) { | |
std::cout << item << ","; | |
} | |
cout << "\n"; | |
} | |
} //end namespace util | |
// ************ Data Structures | |
struct TreeNode { | |
int val; | |
TreeNode *left; | |
TreeNode *right; | |
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} | |
}; | |
struct TreeLinkNode { | |
int val; | |
TreeLinkNode *left, *right, *next; | |
TreeLinkNode(int x) : val(x), left(NULL), right(NULL), next(NULL) {} | |
}; | |
// ************* End of Data Structures | |
class Solution { | |
public: | |
void solve() {} | |
}; | |
int main() { | |
Solution s; | |
// impl | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment