Beispiel #1
0
 forceinline void 
 OmegaTree<TaskView>::insert(int i) {
   leaf(i).e = tasks[i].e(); 
   leaf(i).env = 
     static_cast<long long int>(c)*tasks[i].est()+tasks[i].e();
   update(i);
 }
Beispiel #2
0
    [[nodiscard]] std::set<pt> connections() const {
        std::set<ptpair> S;
        std::set<pt>     P;

        for (size_t i = 0; i < size.x; ++i) {
            for (size_t j = 0; j < size.y; ++j) {
                for (int xx = 1; xx < 100; ++xx) {
                    double            x  = .01 * xx;
                    std::pair<pt, pt> pp = leaf(pt(i, j, x, 0), nullptr);

                    if ((pp.first != pt()) && (pp.second != pt())) {
                        if (S.count(pp) == 0) {
                            S.insert(pp);
                            P.insert(pt(i, j, x, 0));
                        }
                    }

                    pp = leaf(pt(i, j, 0, x), nullptr);

                    if ((pp.first != pt()) && (pp.second != pt())) {
                        if (S.count(pp) == 0) {
                            S.insert(pp);
                            P.insert(pt(i, j, 0, x));
                        }
                    }
                }
            }
        }
        return P;
    }
Beispiel #3
0
void leaf(turtle_t &turt, double length)
{
  double factor,i;
  
factor=length/10;
 if(factor<=0.005)
   return;
 else{
  
   for(i=2.0;i<=4.2;i=i+0.2){
turt.forward(factor);
turt.turn_right(45);
leaf(turt,4.2*factor/i);
turt.forward(4.8*factor/i);
turt.backward_move(4.8*factor/i);
turt.turn_left(45);
turt.forward(factor/6);
turt.turn_left(45);
leaf(turt,4.2*factor/i);
turt.forward(4.8*factor/i);
turt.backward_move(4.8*factor/i);

turt.turn_right(45.15);

   }
turt.forward(factor/8);
turt.backward_move(length+3*factor);


}
     
     
}
Beispiel #4
0
 OmegaTree<TaskView>::OmegaTree(Region& r, int c0,
                                const TaskViewArray<TaskView>& t)
   : TaskTree<TaskView,OmegaNode>(r,t), c(c0) {
   for (int i=tasks.size(); i--; ) {
     leaf(i).e = 0; leaf(i).env = -Limits::llinfinity;
   }
   init();
 }
Beispiel #5
0
 template<class TaskView> void
 ExtOmegaTree<TaskView>::init(int ci0) {
   ci = ci0;
   for (int i=tasks.size(); i--; ) {
     leaf(i).e = 0; 
     leaf(i).env = leaf(i).cenv = -Limits::llinfinity;
   }
   init();
 }
Beispiel #6
0
int leaf(Tnode *r)
{
	if(r==NULL)
		return 0;
	else if(r->lchild==NULL&&r->rchild==NULL)
		return 1;
	else
		return leaf(r->lchild)+leaf(r->rchild);
}
Beispiel #7
0
void assignBMEWeights(meTree *T, double **A)
{
  meEdge *e;
  e = depthFirstTraverse(T,NULL);
  while (NULL != e) {
    if ((leaf(e->head)) || (leaf(e->tail)))
      BalWFext(e,A);
    else
      BalWFint(e,A);
    e = depthFirstTraverse(T,e);
  }
}      
Beispiel #8
0
int  leaf(BinTree T)
{
    int n1,n2;
    if(!T) return 0;
    else if((!T->lchild) &&  (!T->rchild))return 1;
    else
    {
        n1=leaf(T->lchild);
        n2=leaf(T->rchild);
        return(n1+n2);
    }
}
Beispiel #9
0
int leaf(node *r)
{
	if(!r)
		return 0;
	else
	{
		if( NULL == r->lChild &&
			NULL == r->rChild )
			return 1;
		else
			return leaf(r->rChild) + leaf(r->lChild);
	}
}
bool leaf(struct node *root,int le,int *lef)
{
    if(root==NULL)return true;
    if(root->left==NULL &&root->right==NULL)
    {
        if(*lef==0)
        {
            *lef=le;
            return true;
        }
        return(*lef==le);
    }
    return leaf(root->left,le+1,lef)&&
    leaf(root->right,le+1,lef);
}
Beispiel #11
0
 forceinline void 
 OmegaLambdaTree<TaskView>::shift(int i) {
   // i is in omega
   assert(leaf(i).env > -Limits::llinfinity);
   leaf(i).le = leaf(i).e;
   leaf(i).e = 0;
   leaf(i).lenv = leaf(i).env;
   leaf(i).env = -Limits::llinfinity;
   leaf(i).resLe = i;
   leaf(i).resLenv = i;
   update(i);
 }
Beispiel #12
0
/*
 * traverse the whole tree in a deletion-safe way, calling node_before at
 * nodes, leaf at leaves, and node_after when back at nodes, passing data along
 * the way through nodes. data returned by leaf() is ignored.
 *
 * Hooks can modify the pointer they're given to remove or replace themselves.
 */
static void
traverse(topo_topology_t topology,
	 topo_obj_t *father,
	 void (*node_before)(topo_topology_t topology, topo_obj_t *obj, void *),
	 void (*leaf)(topo_topology_t topology, topo_obj_t *obj, void *),
	 void (*node_after)(topo_topology_t topology, topo_obj_t *obj, void *),
	 void *data)
{
  topo_obj_t *pobj, obj;

  if (!(*father)->first_child) {
    if (leaf)
      leaf(topology, father, data);
    return;
  }
  if (node_before)
    node_before(topology, father, data);
  if (!(*father))
    return;
  for (pobj = &(*father)->first_child, obj = *pobj;
       obj;
       /* Check whether the current obj was dropped.  */
       (*pobj == obj ? pobj = &(*pobj)->next_sibling : 0),
       /* Get pointer to next object.  */
	obj = *pobj)
    traverse(topology, pobj, node_before, leaf, node_after, data);
  if (node_after)
    node_after(topology, father, data);
}
Beispiel #13
0
/*assumes tree is only trifurcated at root*/
tree *detrifurcate(tree *T)
{
  node *v, *w;
  edge *e, *f;
  v = T->root;
  if(leaf(v))
    return(T);
  if (NULL != v->parentEdge)
    {
      Rprintf ("Error: root %s is poorly rooted.\n",v->label);
      exit(0);
    }
  for(e = v->middleEdge, v->middleEdge = NULL; NULL != e; e = f )
    {
      w = e->head;
      v = e->tail;
      e->tail = w;
      e->head = v;
      f = w->leftEdge;
      v->parentEdge = e;
      w->leftEdge = e;
      w->parentEdge = NULL;
    }
  T->root = w;
  return(T);
}
Beispiel #14
0
void CPatcherWindow::UpdatePatcherStatus()
{
	m_patchProgress.SetRange(0, m_patchPaths.size());

	if(m_patchResult != PATCHER_SERVICE_RESULT_SUCCESS)
	{
		m_patchStatusLabel.SetText(_T("Patch failed."));
		m_patchProgress.SetPosition(m_patchPaths.size());
		m_patchProgress.SetState(PBST_ERROR);
	}
	else if(m_patchIdx == m_patchPaths.size())
	{
		//Complete
		m_patchStatusLabel.SetText(_T("Complete!"));
		m_patchProgressLabel.SetText(_T("100%"));
		m_patchProgress.SetPosition(m_patchIdx);
	}
	else
	{
		auto nextPatchPath = m_patchPaths[m_patchIdx];
		unsigned int patchPercent = static_cast<unsigned int>(static_cast<float>(m_patchIdx) / static_cast<float>(m_patchPaths.size()) * 100.f);
		m_patchProgress.SetPosition(m_patchIdx);
		m_patchStatusLabel.SetText(string_format(_T("Applying '%s'..."), nextPatchPath.leaf().native().c_str()).c_str());
		m_patchProgressLabel.SetText(string_format(_T("%d%%"), patchPercent).c_str());
	}
}
Beispiel #15
0
static Tree *
post(Lex *lxp)
{
	Tree *lp;

	if ((lp = leaf(lxp)) == 0)
		return 0;
	switch (lxp->tok)
	{
	case ROP_EMPTY:	/* this was {0,0} ROP_BRACE */
		libuxre_regdeltree(lp, 1);
		lp = 0;
		/*FALLTHROUGH*/
	case ROP_BRACE:
	case ROP_STAR:
	case ROP_PLUS:
	case ROP_QUEST:
		if ((lp = libuxre_reg1tree(lxp->tok, lp)) == 0)
		{
			lxp->err = REG_ESPACE;
			return 0;
		}
		if (lxp->tok == ROP_BRACE)
			lp->right.info = lxp->info;
		/*FALLTHROUGH*/
	case ROP_NOP:	/* this was {1,1} ROP_BRACE */
		if (lex(lxp) != 0)
		{
			libuxre_regdeltree(lp, 1);
			return 0;
		}
		break;
	}
	return lp;
}
Beispiel #16
0
// Converts a SyntaxNode tree to a Moses::GHKM::ParseTree.
std::auto_ptr<ParseTree> XmlTreeParser::ConvertTree(
    const SyntaxNode &tree,
    const std::vector<std::string> &words)
{
  std::auto_ptr<ParseTree> root(new ParseTree(tree.GetLabel()));
  const std::vector<SyntaxNode*> &children = tree.GetChildren();
  if (children.empty()) {
    if (tree.GetStart() != tree.GetEnd()) {
      std::ostringstream msg;
      msg << "leaf node covers multiple words (" << tree.GetStart()
          << "-" << tree.GetEnd() << "): this is currently unsupported";
      throw Exception(msg.str());
    }
    std::auto_ptr<ParseTree> leaf(new ParseTree(words[tree.GetStart()]));
    leaf->SetParent(root.get());
    root->AddChild(leaf.release());
  } else {
    for (std::vector<SyntaxNode*>::const_iterator p = children.begin();
         p != children.end(); ++p) {
      assert(*p);
      std::auto_ptr<ParseTree> child = ConvertTree(**p, words);
      child->SetParent(root.get());
      root->AddChild(child.release());
    }
  }
  return root;
}
Beispiel #17
0
void NewickPrintTreeStr(tree *T, char *str)
{
  if (leaf(T->root))
    NewickPrintBinaryTree(T,str);
  else
    NewickPrintTrinaryTree(T,str);
}
Beispiel #18
0
status_t
WinampSkinThemesAddon::SPSkin(BString *to, bool preffile)
{
	if (preffile) {
		status_t err;
		BMessage settings;
		BPath SPSPath;
		
		if (find_directory(B_USER_SETTINGS_DIRECTORY, &SPSPath) < B_OK)
			return B_ERROR;
		BString leaf(SP_SETTINGS_NAME);
		BString user(getenv("USER"));
		user.RemoveFirst("USER="******"$USER", user.String());
		SPSPath.Append(leaf.String());
		PRINT(("SPP %s\n", SPSPath.Path()));
		BFile SPSettings(SPSPath.Path(), B_READ_ONLY);
		if (SPSettings.InitCheck() < B_OK)
			return SPSettings.InitCheck();
		if (settings.Unflatten(&SPSettings) < B_OK)
			return EIO;
		err = settings.FindString("skinname", to);
		StripPath(to);
		return err;
	}
	BMessenger msgr(SP_APP_SIG);
	BMessage msg('skin');
	BMessage reply;
	msgr.SendMessage(&msg, (BHandler *)NULL, 500000);
	if (reply.FindString("result", to) >= B_OK) {
		StripPath(to);
		return B_OK;
	}
	return B_ERROR;
}
std::auto_ptr<cpunit::TestRunner>
cpunit::TestExecutionFacade::get_test_runner(const bool robust, const double max_time) const {
  std::auto_ptr<TestRunner> leaf(new BasicTestRunner);

  if (robust) {
    CPUNIT_ITRACE("TestExecutionFacade::get_test_runner - Returning robust TestRunner");

    // For handling of extra, custom exceptions, insert your handler here,
    // and remember to modify the next decorator insertion...
    // std::auto_ptr<TestRunnerDecorator> d1(new MyCustomHandler);
    // d1->set_inner(leaf.release());

    // Add a layer of exception handling over the executing test runner
    std::auto_ptr<TestRunnerDecorator> d2(new RunAllTestRunner);
    d2->set_inner(leaf.release());

    // Add a layer of time taking
    std::auto_ptr<TestRunnerDecorator> d3(new TimeGuardRunner(max_time));
    d3->set_inner(d2.release());

    // Add a new layer of exception handling in case the max-time is exceeded
    std::auto_ptr<TestRunnerDecorator> d4(new RunAllTestRunner);
    d4->set_inner(d3.release());

    return std::auto_ptr<TestRunner>(d4.release());
  } else {
    CPUNIT_ITRACE("TestExecutionFacade::get_test_runner - Returning BasicTestRunner");

    // Add a layer of time taking over the executing test runner
    std::auto_ptr<TestRunnerDecorator> d1(new TimeGuardRunner(max_time));
    d1->set_inner(leaf.release());

    return std::auto_ptr<TestRunner>(d1.release());
  }
}
Beispiel #20
0
list<int> suc_polytomy(int i,int j,Pr* pr,Node** nodes,int* & Pre,list<int> &suc){
    list<int> result;
    if (leaf(nodes[i])) {
        nodes[j]->D=nodes[i]->D;
        activeMarkLeaf(nodes[j]);
    }
    if (j>=pr->nbINodes) {
        result.push_back(j);
        Pre[j]=i;
        if (markLeaf(nodes[j]) || j<pr->nbINodes) suc.push_back(j);
    }
    else{
        for (vector<int>::iterator iter=nodes[j]->suc.begin(); iter!=nodes[j]->suc.end(); iter++) {
            int s=*iter;
            if (!tc(nodes[s])) {
                Pre[s]=i;
                if (markLeaf(nodes[s]) || s<pr->nbINodes) suc.push_back(s);
            }
            else{
                list<int> l1=suc_polytomy(i,s,pr,nodes,Pre,suc);
                concatPos(l1,result);
            }
        }
        if (j!=i) result.push_back(j);
    }
    return result;
}
	std::vector< std::pair< prm::qualified_path, std::string > > get_available_agent_specs(prm::param_accessor param_vals)
	{
		std::vector< std::pair< prm::qualified_path, std::string > > names;

		auto node = param_vals["agent_spec_list"];
		auto agent_spec_list_path = resolve_id("agent_spec_list", param_vals.get_root(), param_vals.get_current_path(), param_vals.get_all_paths());
		for(auto agent_entry : node)
		{
			auto agent_repeat_num = agent_entry.first.as< unsigned int >();
			auto agent = agent_entry.second;

			auto rel_path = prm::qualified_path({ "spec" }) + std::string{ "name" };
			auto name_node = prm::find_value(agent, rel_path);
			assert(name_node);

			auto spec_path = agent_spec_list_path;
			spec_path.leaf().set_index(agent_repeat_num);
			spec_path += std::string("spec");

			names.emplace_back(std::make_pair(
				spec_path,
				name_node.as< std::string >()
				));
		}

		return names;
	}
Beispiel #22
0
	bool param_tree::add_repeat_instance(tree_t::node_descriptor rpt_node, param_accessor acc, schema::schema_provider_map_handle sch_mp)
	{
		auto nd_attribs = m_tree[rpt_node];
		if(nd_attribs.type != ParamType::Repeat)
		{
			return false;
		}

		// TODO: respect repeat max count
		auto inst_num = 0;
		bool first = m_tree.child_count(rpt_node) == 0;
		if(!first)
		{
			// Get the edge of the rightmost existing instance
			auto edge = m_tree.in_edge(m_tree.get_rightmost_child(rpt_node).first).first;
			// And add 1 to its instance number to generate the instance number of the new instance
			// Note: This assumes that instances cannot be repositioned once created.
			inst_num = *m_tree[edge].repeat_idx + 1;
		}
		auto instance = m_tree.add_node(rpt_node).second;
		m_tree[m_tree.in_edge(instance).first].repeat_idx = inst_num;

		auto path = node_qpath(rpt_node);
		path.leaf().set_index(inst_num);
		auto contents_name = boost::any_cast<repeat_extra>(m_tree[rpt_node].extra).contents_name;
		path += contents_name;

		//acc.set_lock_on_failed_move(true);
		acc.move_to(path);
		auto sch = sch_mp->at(path.unindexed())(acc);
		generate_from_schema(sch, instance, acc, sch_mp);
		return true;
	}
void
CAGAppleExample::draw(IGrafPort& port)
{
        // Start with an IGArea defining the left side of the apple.
        IGArea apple(IGEllipse2D(IGRect2D(0,64,96,176)));

        // Add in the right side of the apple.
        apple += IGEllipse2D(IGRect2D(32,64,128,176));

        // And the apple stem.
        apple += IGRect2D(63,32,65,72);

        // Now, add the right leaf.
        IGArea leaf(IGEllipse2D(IGRect2D(40,16,88,64)));
        leaf *= IGEllipse2D(IGRect2D(64,40,112,88));
        apple += leaf;

        // Flip the right leaf around and use it as the left leaf.
        leaf.transformBy(IGrafMatrix(IGPoint2D(-1,1), IGPoint2D(64,0)));
        leaf.transformBy(IGrafMatrix(IGPoint2D(0,-16)));
        apple += leaf;

        // Draw the result.
        port.draw(apple, IFillAndFrameBundle(kDefaultFillColor, kDefaultFrameColor, kDefaultPenWidth));
}
Beispiel #24
0
/*fillTableUp fills all the entries in D associated with
  e->head,f->head and those edges g->head above e->head*/
void fillTableUp(edge *e, edge *f, double **A, double **D, tree *T)
{
  edge *g,*h;
  if (T->root == f->tail)
    {
      if (leaf(e->head))
	A[e->head->index][f->head->index] =
	  A[f->head->index][e->head->index] =
	  D[e->head->index2][f->tail->index2];
      else
	{
	  g = e->head->leftEdge;
	  h = e->head->rightEdge;
	  A[e->head->index][f->head->index] =
	    A[f->head->index][e->head->index] =
	    (g->bottomsize*A[f->head->index][g->head->index]
	     + h->bottomsize*A[f->head->index][h->head->index])
	    /e->bottomsize;
	}
    }
  else
    {
      g = f->tail->parentEdge;
      fillTableUp(e,g,A,D,T); /*recursive call*/
      h = siblingEdge(f);
      A[e->head->index][f->head->index] =
	A[f->head->index][e->head->index] =
	(g->topsize*A[e->head->index][g->head->index]
	 + h->bottomsize*A[e->head->index][h->head->index])/f->topsize;
    }
}
nsresult GetAvailableRuntime(nsILocalFile* *_retval)
{
  NS_ENSURE_ARG_POINTER(_retval);
  nsresult rv = NS_ERROR_FAILURE;

  // Get the path of the GRE which is compatible with our embedding application
  // from the registry

  const char *pGREDir = GetAvailableRuntime ();
  if(!pGREDir)
    return NS_ERROR_FAILURE;

  nsCOMPtr<nsILocalFile> xpcomPath;
  nsEmbedCString leaf(pGREDir);
  rv = NS_NewNativeLocalFile(leaf, PR_TRUE, getter_AddRefs(xpcomPath));

  if (NS_FAILED(rv))
    return rv;

  nsCOMPtr<nsIFile> directory;
  rv = xpcomPath->GetParent(getter_AddRefs(directory));
  if (NS_FAILED(rv))
    return rv;

  return CallQueryInterface(directory, _retval);
}
Beispiel #26
0
status_t
WinampSkinThemesAddon::SPSkinPath(BPath *to)
{
	status_t err;
	BMessage settings;
	BPath SPSPath;
	BString str;

	if (find_directory(B_USER_SETTINGS_DIRECTORY, &SPSPath) < B_OK)
		return B_ERROR;
	BString leaf(SP_SETTINGS_NAME);
	BString user(getenv("USER"));
	user.RemoveFirst("USER="******"$USER", user.String());
	SPSPath.Append(leaf.String());
	BFile SPSettings(SPSPath.Path(), B_READ_ONLY);
	if (SPSettings.InitCheck() < B_OK)
		return SPSettings.InitCheck();
	if (settings.Unflatten(&SPSettings) < B_OK)
		return EIO;
	err = settings.FindString("skinpath", &str);
	PRINT(("SPSP %s\n", str.String()));
	to->SetTo(str.String());
	return err;
}
/**
 * Create if missing a Maildir-style folder with "tmp" and "cur" subfolders
 * but no "new" subfolder, because it doesn't make sense in the mail client
 * context. ("new" directory is for messages on the server that haven't been
*  seen by a mail client).
 * aFolderName is already "safe" - it has been through NS_MsgHashIfNecessary.
 */
nsresult nsMsgMaildirStore::CreateMaildir(nsIFile *path)
{
  nsresult rv = path->Create(nsIFile::DIRECTORY_TYPE, 0700);
  if (NS_FAILED(rv) && rv != NS_ERROR_FILE_ALREADY_EXISTS)
  {
    NS_WARNING("Could not create root directory for message folder");
    return rv;
  }

  // Create tmp, cur leaves
  nsCOMPtr<nsIFile> leaf(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
  NS_ENSURE_SUCCESS(rv, rv);

  leaf->InitWithFile(path);

  leaf->AppendNative(NS_LITERAL_CSTRING("tmp"));
  rv = leaf->Create(nsIFile::DIRECTORY_TYPE, 0700);
  if (NS_FAILED(rv) && rv != NS_ERROR_FILE_ALREADY_EXISTS)
  {
    NS_WARNING("Could not create tmp directory for message folder");
    return rv;
  }

  leaf->SetNativeLeafName(NS_LITERAL_CSTRING("cur"));
  rv = leaf->Create(nsIFile::DIRECTORY_TYPE, 0700);
  if (NS_FAILED(rv) && rv != NS_ERROR_FILE_ALREADY_EXISTS)
  {
    NS_WARNING("Could not create cur directory for message folder");
    return rv;
  }

  return NS_OK;
}
Beispiel #28
0
static PRBool
CopyFileIntoUpdateDir(nsIFile *parentDir, const char *leafName, nsIFile *updateDir)
{
    nsDependentCString leaf(leafName);
    nsCOMPtr<nsIFile> file;

    // Make sure there is not an existing file in the target location.
    nsresult rv = updateDir->Clone(getter_AddRefs(file));
    if (NS_FAILED(rv))
        return PR_FALSE;
    rv = file->AppendNative(leaf);
    if (NS_FAILED(rv))
        return PR_FALSE;
    file->Remove(PR_FALSE);

    // Now, copy into the target location.
    rv = parentDir->Clone(getter_AddRefs(file));
    if (NS_FAILED(rv))
        return PR_FALSE;
    rv = file->AppendNative(leaf);
    if (NS_FAILED(rv))
        return PR_FALSE;
    rv = file->CopyToNative(updateDir, EmptyCString());
    if (NS_FAILED(rv))
        return PR_FALSE;

    return PR_TRUE;
}
Beispiel #29
0
  forceinline long long int
  ExtOmegaTree<TaskView>::env(int i) {
    // Enter task i
    leaf(i).e = tasks[i].e(); 
    leaf(i).env = 
      static_cast<long long int>(c)*tasks[i].est()+tasks[i].e();
    leaf(i).cenv = 
      static_cast<long long int>(c-ci)*tasks[i].est()+tasks[i].e();
    TaskTree<TaskView,ExtOmegaNode>::update(i);

    // Perform computation of node for task with minest
    int met = 0;
    {
      long long int e = 0;
      while (!n_leaf(met)) {
        if (plus(node[n_right(met)].cenv,e) > 
            static_cast<long long int>(c-ci) * tasks[i].lct()) {
          met = n_right(met);
        } else {
          e += node[n_right(met)].e; met = n_left(met);
        }
      }
    }

    /*
     * The following idea to compute the cut in one go is taken from:
     * Joseph Scott, Filtering Algorithms for Discrete Resources, 
     * Master Thesis, Uppsala University, 2010 (in preparation).
     */

    // Now perform split from leaf met upwards
    long long int a_e = node[met].e;
    long long int a_env = node[met].env;
    long long int b_e = 0;

    while (!n_root(met)) {
      if (left(met)) {
        b_e += node[n_right(n_parent(met))].e;
      } else {
        a_env = std::max(a_env, plus(node[n_left(n_parent(met))].env,a_e));
        a_e += node[n_left(n_parent(met))].e;
      }
      met = n_parent(met);
    }

    return plus(a_env,b_e);
  }
Beispiel #30
0
PriorityQueue emptyPriorityQueue(){
    PriorityQueue newPQ = new PriorityQueueStr;
    newPQ -> totalSize = 256; // Hardcodeo 256 porque estamos trabajando con codificacion ASCII y la máxima cantidad posible de elementos diferentes es 256.
    newPQ -> elements = new HuffmanTree[newPQ -> totalSize + 1];
    newPQ -> actualSize = 0;
    newPQ -> elements[0] = leaf('x',0); // Necesito quedarme con la posicion 0 para guardar el elemento más prioritario allí.
    return newPQ;
}