Skip to content

Commit

Permalink
bst functions out of the context of lib and in the context of push_swap.
Browse files Browse the repository at this point in the history
  • Loading branch information
gfantonib committed Feb 26, 2024
1 parent 1cbbb98 commit e8c7007
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 79 deletions.
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# By: gfantoni <gfantoni@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/01/26 11:03:46 by josfelip #+# #+# #
# Updated: 2024/02/21 18:00:55 by gfantoni ### ########.fr #
# Updated: 2024/02/26 16:53:46 by gfantoni ### ########.fr #
# #
# **************************************************************************** #

Expand All @@ -32,7 +32,14 @@ HEADER = $(HEADER_PATH)push_swap.h
OBJ_PATH = ./obj/
DEBUG_OBJ_PATH = ./obj_debug/
SOURCES_PATH = ./sources/
SOURCES = 00_main.c 01_user_input_validation.c 02_indexing.c 03_do_moves.c 03_moves.c 04_pre_sort.c 05_target_position.c 06_comp_cost.c 07_cheapest_move.c 08_sort.c 09_push_swap.c 10_dial.c 93_utils.c 94_utils.c 95_utils.c 96_utils.c 97_utils.c 98_utils.c 99_2_utils.c 99_utils.c
SOURCES = 00_main.c 01_user_input_validation.c 02_indexing.c 03_do_moves.c \
03_moves.c 04_pre_sort.c 05_target_position.c 06_comp_cost.c \
07_cheapest_move.c 08_sort.c 09_push_swap.c 10_dial.c 93_utils.c \
94_utils.c 95_utils.c 96_utils.c 97_utils.c 98_utils.c 99_2_utils.c \
99_utils.c \
bst_breadth.c bst_check_node.c bst_del_utils.c bst_min_max.c \
bst_nodes.c bst_traversal.c

MANDATORY_SOURCES = $(addprefix $(SOURCES_PATH), $(SOURCES))

ifdef WITH_DEBUG
Expand Down
5 changes: 2 additions & 3 deletions lib/sources/bst/includes/bst.h → includes/bst.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
/* By: gfantoni <gfantoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/26 16:17:51 by gfantoni #+# #+# */
/* Updated: 2024/02/26 16:34:45 by gfantoni ### ########.fr */
/* Updated: 2024/02/26 16:49:13 by gfantoni ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef BST_H
# define BST_H

//# include <limits.h>
# include "../../functions/includes/functions.h"
# include "../lib/includes/libft.h"

# define TRUE 1
# define FALSE 0
Expand Down
14 changes: 6 additions & 8 deletions includes/push_swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@
/* By: gfantoni <gfantoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/30 10:52:24 by josfelip #+# #+# */
/* Updated: 2024/02/26 09:18:48 by gfantoni ### ########.fr */
/* Updated: 2024/02/26 16:51:08 by gfantoni ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef PUSH_SWAP_H
# define PUSH_SWAP_H

# ifndef DEBUG
# define DEBUG 0
# endif

# include "../lib/includes/libft.h"
# include <stdlib.h>
# include <unistd.h>
# include <limits.h>
# include "bst.h"

// # include <stdlib.h>
// # include <unistd.h>
// # include <limits.h>

enum e_op
{
Expand Down
11 changes: 2 additions & 9 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,29 @@ NAME = libft.a
GET_NEXT_LINE = sources/get_next_line/get_next_line.a
GET_NEXT_LINE_PATH = sources/get_next_line/

BST = sources/bst/bst.a
BST_PATH = sources/bst/

FUNCTIONS = sources/functions/functions.a
FUNCTIONS_PATH = sources/functions/

all: $(FUNCTIONS) $(GET_NEXT_LINE) $(BST) $(NAME)
all: $(FUNCTIONS) $(GET_NEXT_LINE) $(NAME)

$(GET_NEXT_LINE):
make -C $(GET_NEXT_LINE_PATH)

$(BST):
make -C $(BST_PATH)

$(FUNCTIONS):
make -C $(FUNCTIONS_PATH)

$(NAME):
ar -rcT $(NAME) $(FUNCTIONS) $(GET_NEXT_LINE) $(BST)
ar -rcT $(NAME) $(FUNCTIONS) $(GET_NEXT_LINE)

clean:
make clean -C $(FUNCTIONS_PATH)
make clean -C $(GET_NEXT_LINE_PATH)
make clean -C $(BST_PATH)

fclean: clean
rm -f $(NAME)
make fclean -C $(FUNCTIONS_PATH)
make fclean -C $(GET_NEXT_LINE_PATH)
make fclean -C $(BST_PATH)

re: fclean all

Expand Down
3 changes: 1 addition & 2 deletions lib/includes/libft.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: gfantoni <gfantoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/22 13:02:21 by gfantoni #+# #+# */
/* Updated: 2024/01/31 11:16:16 by gfantoni ### ########.fr */
/* Updated: 2024/02/26 16:49:34 by gfantoni ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -15,6 +15,5 @@

# include "../sources/functions/includes/functions.h"
# include "../sources/get_next_line/includes/get_next_line.h"
# include "../sources/bst/includes/bst.h"

#endif
40 changes: 0 additions & 40 deletions lib/sources/bst/Makefile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: gfantoni <gfantoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/27 11:03:23 by gfantoni #+# #+# */
/* Updated: 2024/02/26 15:52:18 by gfantoni ### ########.fr */
/* Updated: 2024/02/26 16:48:11 by gfantoni ### ########.fr */
/* */
/* ************************************************************************** */

#include "bst.h"
#include "../includes/bst.h"

static void bst_breadth(t_bst **queue, int front, int total, int rear);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_node.c :+: :+: :+: */
/* bst_check_node.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gfantoni <gfantoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/26 16:25:54 by gfantoni #+# #+# */
/* Updated: 2024/01/27 13:46:59 by gfantoni ### ########.fr */
/* Updated: 2024/02/26 16:48:23 by gfantoni ### ########.fr */
/* */
/* ************************************************************************** */

#include "bst.h"
#include "../includes/bst.h"

int bst_verify(t_bst *node, int minkey, int maxkey)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* del_utils.c :+: :+: :+: */
/* bst_del_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gfantoni <gfantoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/27 12:37:55 by gfantoni #+# #+# */
/* Updated: 2024/01/27 13:47:06 by gfantoni ### ########.fr */
/* Updated: 2024/02/26 16:48:27 by gfantoni ### ########.fr */
/* */
/* ************************************************************************** */

#include "bst.h"
#include "../includes/bst.h"

t_bst *left_right_child_null(t_bst *node, int *was_deleted)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: gfantoni <gfantoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/26 16:20:43 by gfantoni #+# #+# */
/* Updated: 2024/02/23 14:23:28 by gfantoni ### ########.fr */
/* Updated: 2024/02/26 16:48:31 by gfantoni ### ########.fr */
/* */
/* ************************************************************************** */

#include "bst.h"
#include "../includes/bst.h"

int bst_find_minimum(t_bst *node)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/sources/bst/sources/bst_nodes.c → sources/bst_nodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: gfantoni <gfantoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/27 11:39:14 by gfantoni #+# #+# */
/* Updated: 2024/02/26 12:50:49 by gfantoni ### ########.fr */
/* Updated: 2024/02/26 16:48:34 by gfantoni ### ########.fr */
/* */
/* ************************************************************************** */

#include "bst.h"
#include "../includes/bst.h"

t_bst *bst_create_node(int new_key)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* traversal.c :+: :+: :+: */
/* bst_traversal.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gfantoni <gfantoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/26 16:19:41 by gfantoni #+# #+# */
/* Updated: 2024/01/29 10:31:34 by gfantoni ### ########.fr */
/* Updated: 2024/02/26 16:48:36 by gfantoni ### ########.fr */
/* */
/* ************************************************************************** */

#include "bst.h"
#include "../includes/bst.h"

void bst_pre_order(t_bst *node)
{
Expand Down

0 comments on commit e8c7007

Please sign in to comment.