Skip to content

Instantly share code, notes, and snippets.

@scriptnull
Last active January 3, 2019 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scriptnull/cae9896a54566923b43facd51b2bbf26 to your computer and use it in GitHub Desktop.
Save scriptnull/cae9896a54566923b43facd51b2bbf26 to your computer and use it in GitHub Desktop.
My C++ utility code
#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