Advertisement
dyamondz

Màxim d'un arbre n-ari - X66203

Jun 18th, 2018
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. T i_maxim(T&valor, node_arbreNari*n ) const{
  2.     if(n!=NULL){
  3.         for(int i=0; i<n->seg.size(); ++i){
  4.             i_maxim(valor, n->seg[i]);
  5.         }
  6.         if(n->info > valor) valor = n->info;
  7.     }
  8.         return valor;
  9. }
  10.  
  11. T maxim() const{
  12.     T max = this->primer_node->info;
  13.     return i_maxim(max, this->primer_node);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement