Data Structures
martes, 16 de diciembre de 2014
lunes, 15 de diciembre de 2014
Treaps: Find in C++
bool CTree::find (CTree t, key x)
{
if (t== nullnode)
return false;
else
if (t->key == x)
return true;
else
if (t->key < x)
return find (t->right,x)
else;
return find (t->left,x)
}
{
if (t== nullnode)
return false;
else
if (t->key == x)
return true;
else
if (t->key < x)
return find (t->right,x)
else;
return find (t->left,x)
}
Treaps
Trees + Heaps = TREAPS!!!
- Data keys are organized as in a binary search tree
- Priorities organized as in a heap
- The priority of a node is always greater than the priorities of the children
Example:
Suscribirse a:
Comentarios (Atom)








