#define USECHRONO #undef HAVE_MPI #include "eval.hpp" #include #include #include #include using namespace aed; using namespace std; bool even(int x) { return x%2==0; } bool odd(int x) { return x%2; } bool ge7(int x) { return x>=7; } bool le3(int x) { return x<=3; } bool div4(int x) { return x%4==0; } bool isprime(int x) { return is_prime(abs(x)); } bool isnotprime(int x) { return !is_prime(abs(x)); } //---:---<*>---:---<*>- COMIENZA CODIGO FUNCION --:---<*>---:---<*>---:---<*> // COMPLETAR DNI y NOMBRE AQUI: // Nombre: Valentin Pereira int DNI=42994396; void fillbalance(btree &B,list &L,btree::iterator it) { if(L.size()==0)return; if(L.size()==1) {B.insert(it,*L.begin()); return;} listLleft, Lright; auto itL = L.begin(); if(L.size()%2!=0){ int cont = 0, corte = (L.size()-1)/2; while(cont!=corte){ Lleft.push_back(*itL); itL++;cont++; } it = B.insert(it, *itL); itL++; while(itL!=L.end()){ Lright.push_back(*itL); itL++; } fillbalance(B,Lleft,it.left()); fillbalance(B,Lright,it.right()); } if(L.size()%2==0){ int cont = 0, corte = (L.size()/2); do{ Lleft.push_back(*itL); itL++;cont++; } while(cont!=corte); it = B.insert(it,*itL); itL++; while(itL!=L.end()){ Lright.push_back(*itL); itL++; } fillbalance(B,Lleft,it.left()); fillbalance(B,Lright,it.right()); } } void fillbalance(btree &B,list &L) { if( L.empty() )return; btree::iterator it = B.begin(); fillbalance(B,L,B.begin()); } //---:---<*>---:---<*>- FINALIZA CODIGO FUNCION --:---<*>---:---<*>---:---<*> int main() { Eval ev; int vrbs=0; ev.eval<1>(fillbalance,vrbs); return 0; }