Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. //CTreapNode* Insert(CTreapNode*& root, int key, int priority)
  2. //{
  3. //
  4. // if (root->Priority > priority) {
  5. // if (root->Key > key) {
  6. // if (root->Left != 0) {
  7. // Insert(root->Left, key, priority);
  8. // }
  9. // else {
  10. // root->Left = new CTreapNode(key, priority);
  11. // }
  12. // }
  13. // else {
  14. // if (root->Right != 0) {
  15. // Insert(root->Right, key, priority);
  16. // }
  17. // else {
  18. // root->Right = new CTreapNode(key, priority);
  19. // }
  20. // }
  21. // }
  22. // else {
  23. // CTreapNode* newNode = new CTreapNode(key, priority);
  24. // CTreapNode* splitLeft = 0;
  25. // CTreapNode* splitRight = 0;
  26. //
  27. // Split(root, key, splitLeft, splitRight);
  28. // root = newNode;
  29. // root->Left = splitLeft;
  30. // root->Right = splitRight;
  31. // return root;
  32. // }
  33. //
  34. // return root;
  35. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement