Guest User

Untitled

a guest
Dec 16th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. void Dict::insert(itemType v, infoType info)
  2.   {
  3.     x = head; p = head; g = head;
  4.     while (x != z)
  5.       {
  6.         gg = g; g = p; p = x;
  7.         x = (v < x->key) ? x->l :  x->r;
  8.         if (x->l->b && x->r->b) split(v);
  9.       }
  10.     x = new node(v, info, 1, z, z);
  11.     if (v < p->key) p->l = x; else p->r = x;
  12.     split(v); head->r->b = black;
  13.   }
Add Comment
Please, Sign In to add comment