Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- //cau 1
- // i = 4
- //50 17 15 9 62 86 12 14 32 6
- //50 17
- //50 17 15
- //50 17 15 9
- //62 50 17 15 9
- //86 62 50 17 15 9
- //86 62 50 17 15 12 9
- //86 62 50 17 15 14 12 9
- //86 62 50 32 17 15 14 12 9
- //86 62 50 32 17 15 14 12 9 6
- //cau 2
- //typedef struct item* ptr;
- //struct item{
- // int info;
- // ptr next;
- //};
- //
- //void ThapPhan(ptr Head)
- //{
- // int i = 0;
- // int sum = 0;
- // ptr p = Head;
- // while (p != NULL)
- // {
- // sum += p->info * pow(2.0, i);
- // i++;
- // p = p->next;
- // }
- //
- // cout << sum;
- //}
- //cau 32
- //struct Node
- //{
- // Node* *pLeft, *pRight;
- // int key;
- //};
- //typedef Node* TREE;
- //
- //int Height(TREE root)
- //{
- // if (root == NULL) return 0;
- // int a = Height((TREE)root->pLeft);
- // int b = Height((TREE)root->pRight);
- // if (a > b) return a;
- // return b;
- //}
- //
- //void DuyetTheoMuc(TREE root, int k, int Muc = 0)
- //{
- // if (root == NULL) return;
- // DuyetTheoMuc((TREE)root->pLeft, k, Muc + 1);
- //
- // if (Muc == k)
- // cout << root->key << "\t";
- //
- // DuyetTheoMuc((TREE)root->pRight, k, Muc + 1);
- //}
- //
- //void main()
- //{
- // TREE root;
- // DuyetTheoMuc(root, 5);
- //}
- //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement