- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelperFunctions.cpp
More file actions
Latest commit
38 lines (32 loc) · 747 Bytes
/
Copy pathhelperFunctions.cpp
File metadata and controls
38 lines (32 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef HELPERFUNCTIONS_CPP
#defineHELPERFUNCTIONS_CPP
#include"helperFunctions.h"
usingnamespacestd;
template <typename T>
voiddisplay2DVector(const vector<vector<T>> &arr)
{
for (constauto &row : arr)
{
for (constauto &elem : row)
cout << elem << "";
cout << endl;
}
}
template <typename T>
voiddisplayVector(const vector<T> &arr)
{
for (constauto &x : arr)
cout << x << "";
}
TreeNode *createDefaultTree()
{
TreeNode *root = newTreeNode(1);
root->left = newTreeNode(2);
root->left->left = newTreeNode(4);
root->left->right = newTreeNode(5);
root->left->right->left = newTreeNode(6);
root->left->right->right = newTreeNode(7);
root->right = newTreeNode(3);
return root;
}
#endif