Jump to content

Tree in C

- - - - -

  • Please log in to reply
1 reply to this topic

#1
Apprentice123

Apprentice123

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 430 posts
Having the following file .h


typedef char info;

typedef struct nodo Tree; 


struct nodo { 

  info dado;

  Tree *firstSon; 

  Tree *nextBrother;

}; 


Tree * InsertSheet(Tree * Nodo, info dado);

Tree * RemoveSheet(Tree * nodoSheet, Tree * root);

Tree * SearchWidth(Tree * root, info dado);

Tree * SearchDepth(Tree * root, info dado);

void PrintWidth(Tree * root);

void PrintDepth(Tree * root);

void destroy(Tree * root);


The function insert this correct?


Tree * InsertSheet(Tree * Nodo, info dado);

{

	Tree *aux;

	if(Nodo == NULL)

	{

		aux->dado = dado;

		aux->firstSon = NULL;

		aux->nextBrother = NULL;

		Nodo = aux;

		return Nodo;

	}

	aux->dado = dado;

	Nodo->firstSon = aux;

	return Nodo;

}


How can I build the function to remove?

#2
Ancient Dragon

Ancient Dragon

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 400 posts
See your post over on DaniWeb.com
Visit Grandpa's Forums, a social networking forum, with family-oriented arcade games, blogs, discussion forums, and photo albums.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users