struct node* searchParent(struct node* root, int x)
{
if((root->left_child != NULL && root->left_child->data == x) || (root->right_child != NULL && root->right_child->data == x))
{
return root;
}
else
{
if(root->left_child != NULL && x < root->data)
{
return searchParent(root->left_child, x);
}
else
if(root->right_child != NULL && x > root->data)
{
return searchParent(root->right_child, x);
}
}
}
#include <iostream>
using namespace std;
int main()
{
int const n = 3;
int intArray[n];
int sum;
for (int i = 0; i < n; i++)
{
cin >> intArray[i];
}
for (int mask = 0; mask < (1 << n); ++mask)
{
sum = 0;
for (int i = 0; i < n; i++)
{
if (mask & (1 << i))
{
sum = sum + intArray[i];
}
}
cout << sum <<" ";
}
return 0;
}