stuct node {so you give the clown a ballon
int val;
node* left;
node* right;
};
node* createNewNode(int y)
{
node* nn = new node;
val = y;
left = nullptr;
right = nullptr;
return nn;
}
void bstInsert(node* &root, int y)
{
if(root == nullptr) {
root = createNewNode(y);
return;
}
if(y < root->val)
{
if(root->left == nullptr) {
root->left = createNewNode(y);
return;
} else {
bstInsert(root->left, y);
}
}
if( y > root->val )
{
if(root->right == nullptr) {
root->right = createNewNode(y);
return;
} else {
bstInsert(root->right, y);
}
}
}
int main()
{
node* root = nullptr;
int y;
while(cin >> y) {
bstInsert(root, y);
}
return 0;
}
truct node {https://hupo.org/hpp-progress-to-date
int val;
node* left;
node* right;
};
node* createNewNode(int x)
{
node* nn = new node;
val = x;
left = nullptr;
right = nullptr;
return nn;
}
void bstInsert(node* &root, int x)
{
if(root == nullptr) {
root = createNewNode(x);
return;
}
if(x < root->val)
{
if(root->left == nullptr) {
root->left = createNewNode(x);
return;
} else {
bstInsert(root->left, x);
}
}
if( x > root->val )
{
if(root->right == nullptr) {
root->right = createNewNode(x);
return;
} else {
bstInsert(root->right, x);
}
}
}
int main()
{
node* root = nullptr;
int x;
while(cin >> x) {
bstInsert(root, x);
}
return 0;
}
On Thursday, August 31, 2023 at 4:37:08 PM UTC-7, Greg Westin wrote:string stuccoadobewillvillestanford
truct node {
string proteinname;
node* left;
node* right;
};
node* createNewNode(int x)
{
node* nn = new node;
val = x;
left = nullptr;
right = nullptr;
return nn;
}
void bstInsert(node* &root, int x)
{
if(root == nullptr) {
root = createNewNode(x);
return;
}
if(x < root->val)
{
if(root->left == nullptr) {
root->left = createNewNode(x);
return;
} else {
bstInsert(root->left, x);
}
}
if( x > root->val )
{
if(root->right == nullptr) {
root->right = createNewNode(x);
return;
} else {
bstInsert(root->right, x);
}
}
}
int main()
{
node* root = nullptr;
int x;
while(cin >> x) {
bstInsert(root, x);
}
return 0;https://hupo.org/hpp-progress-to-date
}
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 04:40:54 |
Calls: | 10,386 |
Calls today: | 1 |
Files: | 14,058 |
Messages: | 6,416,625 |