[Noti-aed] createab

Agustín Saenz agustinsaenzc en gmail.com
Jue Nov 9 19:25:22 -03 2023


------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://venus.santafe-conicet.gov.ar/pipermail/noti-aed/attachments/20231109/d99dee40/attachment.html>
------------ próxima parte ------------
#define USECHRONO
#undef HAVE_MPI

#include "eval.hpp"
#include <cassert>
#include <climits>
#include <cstdlib>
#include <stack>
using namespace aed;
using namespace std;

//---:---<*>---:---<*>- COMIENZA CODIGO FUNCION --:---<*>---:---<*>---:---<*>
// COMPLETAR DNI y NOMBRE AQUI:
// Nombre: Saenz Agustin
int DNI=42464943;

//---:---<*>---:---<*>---:---<*>---:---<*>---:---<*>
void createab(btree<int> &B, btree<int>::iterator n,
              list<int> &abpos,list<int> &vals) {
  if (abpos.empty()) return;

  int pos = abpos.front();
  int value = vals.front();
  abpos.pop_front();
  vals.pop_front();

  n = B.insert(n, value);

  if (!abpos.empty() && abpos.front() == (2 * pos + 1))
    createab(B, n.left(), abpos, vals);
  
  if (!abpos.empty() && abpos.front() == (2 * pos + 2))
    createab(B, n.right(), abpos, vals);
}

//---:---<*>---:---<*>---:---<*>---:---<*>---:---<*>
void createab(btree<int> &B, list<int> &abpos,list<int> &vals) {
  createab(B,B.begin(),abpos,vals);
}

//---:---<*>---:---<*>- FINALIZA CODIGO FUNCION --:---<*>---:---<*>---:---<*>
int main() {
  Eval ev;
  int vrbs=0;
  ev.eval<1>(createab,vrbs);
  // ev.evalr<1>(createab,12345,vrbs);
  return 0;
}


Más información sobre la lista de distribución Noti-AED