courses/coursera-sandiego-algorithms/data-structures/assignment004/set_range_sum/set_range_sum.cpp
void splay(Vertex*& root, Vertex* v) {
  // DebugStream() << "    splaying ";  
  if (v == NULL) return;

  // DebugStream() << v->key << " on top of ";
  // if(root != nullptr)
  // {
    // DebugStream() << root-> key << std::endl;
  // }

  while (v->parent != NULL) {
    if (v->parent->parent == NULL) {
      // DebugStream() << "    small_rotation" << std::endl;
      small_rotation(v);
      break;
    }
    // DebugStream() << "    big_rotation" << std::endl;
    big_rotation(v);
  }

  // DebugStream() << "    changing root" << std::endl;
  root = v;
}
// Makes splay of the given vertex and makes
// it the new root.
Makes splay of the given vertex and makes
it the new root.
Makes splay of the given vertex and makes it the new root .
void splay(Vertex*& root, Vertex* v) {
  if (v == NULL) return;
  while (v->parent != NULL) {
    if (v->parent->parent == NULL) {
      small_rotation(v);
      break;
    }
    big_rotation(v);
  }
  root = v;
}
void splay ( Vertex * & root , Vertex * v ) { if ( v == NULL ) return ; while ( v -> parent != NULL ) { if ( v -> parent -> parent == NULL ) { small_rotation ( v ) ; break ; } big_rotation ( v ) ; } root = v ; }
Makes splay of the given vertex and makes
it the new root.
Makes splay of the given vertex and makes it the new root .
// DebugStream() << "    splaying ";   // DebugStream() << v->key << " on top of "; // if(root != nullptr) // { // DebugStream() << root-> key << std::endl; // } // DebugStream() << "    small_rotation" << std::endl; // DebugStream() << "    big_rotation" << std::endl; // DebugStream() << "    changing root" << std::endl;