-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* implement large sort * add visualizer push-swap-pain * implement operate_rb * implement stack_size * implement all oparations * fix filename * refactor witch t_content * update test * format
- Loading branch information
Showing
21 changed files
with
282 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* large_sort.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: reasuke <reasuke@student.42tokyo.jp> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/01/22 16:55:10 by reasuke #+# #+# */ | ||
/* Updated: 2024/02/06 17:45:36 by reasuke ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "push_swap.h" | ||
|
||
// naive implement: insertion sort | ||
// find smallest number of a | ||
// rotate | ||
// push to b | ||
// push to a | ||
|
||
void large_sort(t_stack **p_a, t_stack **p_b, int num_a) | ||
{ | ||
(void)p_a; | ||
(void)p_b; | ||
(void)num_a; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* reverse_rotate.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: reasuke <reasuke@student.42tokyo.jp> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/01/23 17:18:15 by reasuke #+# #+# */ | ||
/* Updated: 2024/02/07 15:04:58 by reasuke ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "push_swap.h" | ||
|
||
void reverse_rotate_stack(t_stack **p_stack) | ||
{ | ||
t_stack *before_last; | ||
t_stack *last; | ||
|
||
if (ft_lstsize(*p_stack) < 2) | ||
return ; | ||
last = ft_lstlast(*p_stack); | ||
before_last = ft_lst_before(*p_stack, last); | ||
before_last->next = NULL; | ||
last->next = *p_stack; | ||
*p_stack = last; | ||
} | ||
|
||
void operate_rra(t_stack **p_a) | ||
{ | ||
reverse_rotate_stack(p_a); | ||
ft_putendl_fd("rra", STDOUT_FILENO); | ||
} | ||
|
||
void operate_rrb(t_stack **p_b) | ||
{ | ||
reverse_rotate_stack(p_b); | ||
ft_putendl_fd("rrb", STDOUT_FILENO); | ||
} | ||
|
||
void operate_rrr(t_stack **p_a, t_stack **p_b) | ||
{ | ||
reverse_rotate_stack(p_a); | ||
reverse_rotate_stack(p_b); | ||
ft_putendl_fd("rrr", STDOUT_FILENO); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.