mirror of
				https://gitlab.com/klmp200/LO27.git
				synced 2025-10-30 04:43:52 +00:00 
			
		
		
		
	nextCol
This commit is contained in:
		| @@ -23,6 +23,14 @@ cellElement * CreateCellElem(){ | ||||
| 	return elem; | ||||
| } | ||||
|  | ||||
| bool is_leaf(cellElement* tree){ | ||||
| 	if (tree->nextCol == NULL && tree->nextRow == NULL){ | ||||
| 		return true; | ||||
| 	} else { | ||||
| 		return false; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| int AddNextCol(cellElement* tree){ | ||||
|  | ||||
| 	cellElement * elem = NULL; | ||||
| @@ -60,7 +68,7 @@ int AddNextRow(cellElement* tree){ | ||||
|  | ||||
| 	elem->value = true; | ||||
| 	elem->nextRow = NULL; | ||||
| 	elem->nextRow = NULL; | ||||
| 	elem->nextCol = NULL; | ||||
| 	if (tree->nextRow == NULL){ | ||||
| 		tree->nextRow = elem; | ||||
| 	}else{ | ||||
| @@ -73,9 +81,7 @@ void removeNextCol(cellElement* tree){ | ||||
| 	printf("---removeNextCol---\n"); | ||||
|  | ||||
| 	if (tree->nextCol != NULL){ | ||||
| 		cellElement * elem = tree->nextCol; | ||||
| 		free(elem); | ||||
| 		elem = NULL; | ||||
| 		free(tree->nextCol); | ||||
| 		tree->nextCol = NULL; | ||||
| 	} | ||||
|  | ||||
| @@ -85,9 +91,7 @@ void removeNextRow(cellElement* tree){ | ||||
| 	printf("---removeNextRow---\n"); | ||||
|  | ||||
| 	if (tree->nextRow != NULL){ | ||||
| 		cellElement* elem = tree->nextRow; | ||||
| 		free(elem); | ||||
| 		elem =NULL; | ||||
| 		free(tree->nextRow); | ||||
| 		tree->nextRow = NULL; | ||||
| 	} | ||||
|  | ||||
| @@ -95,16 +99,16 @@ void removeNextRow(cellElement* tree){ | ||||
| void recursivePrint(cellElement * tree){ | ||||
| 	if (tree != NULL){ | ||||
| 		printf("Elem : x: %d  y: %d \n",tree->colIndex,tree->rowIndex); | ||||
| 		if (tree->nextCol != NULL){ | ||||
| 			recursivePrint(tree->nextCol); | ||||
| 		} | ||||
| 		if (tree->nextRow != NULL){ | ||||
| 			recursivePrint(tree->nextRow); | ||||
| 		} | ||||
| 		if (tree->nextCol == NULL && tree->nextCol == NULL){ | ||||
| 		if (is_leaf(tree)){ | ||||
| 			printf("leaf\n"); | ||||
| 		} else { | ||||
| 			if (tree->nextCol != NULL){ | ||||
| 				recursivePrint(tree->nextCol); | ||||
| 			} | ||||
| 			if (tree->nextRow != NULL){ | ||||
| 				recursivePrint(tree->nextRow); | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user