aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-07-21 11:44:39 +0200
committerCharles <sircharlesaze@gmail.com>2020-07-21 11:44:39 +0200
commit7513e3aa5266733470cf5033a771909b92978c78 (patch)
tree94182337f035a7c25d13ef1a3725228058c692e6
parent2e79b4ac22321abd69c7f1a9748b5761abaab1ec (diff)
downloadpush_swap-7513e3aa5266733470cf5033a771909b92978c78.tar.gz
push_swap-7513e3aa5266733470cf5033a771909b92978c78.tar.bz2
push_swap-7513e3aa5266733470cf5033a771909b92978c78.zip
Updated README
-rw-r--r--README.md2
-rw-r--r--src/push_swap/sort.c34
2 files changed, 34 insertions, 2 deletions
diff --git a/README.md b/README.md
index 0728978..7eb2344 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# push_swap [![Build Status](https://api.travis-ci.com/HappyTramp/push_swap.svg?branch=master)](https://travis-ci.com/HappyTramp/push_swap)
+# push_swap [![Build Status](https://api.travis-ci.com/cacharle/push_swap.svg?branch=master)](https://travis-ci.com/cacharle/push_swap)
push_swap project of school 42
diff --git a/src/push_swap/sort.c b/src/push_swap/sort.c
index 1639769..b6113e9 100644
--- a/src/push_swap/sort.c
+++ b/src/push_swap/sort.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/19 09:12:02 by cacharle #+# #+# */
-/* Updated: 2020/01/22 11:08:00 by cacharle ### ########.fr */
+/* Updated: 2020/07/21 11:43:00 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,6 +17,36 @@ static int frame_length(t_stack *st, int frame_index)
return (stack_length(st) - frame_index);
}
+/* static void push_swap_sort3(t_stack *main, int main_frame) */
+/* { */
+/* #<{(| 1 < 2 < 3 |)}># */
+/* #<{(| 2 < 3 < 1 |)}># */
+/* #<{(| 3 < 1 < 2 |)}># */
+/* #<{(| 3 < 2 < 1 |)}># */
+/* #<{(| 2 < 1 < 3 |)}># */
+/* #<{(| 1 < 3 < 2 |)}># */
+/* */
+/* int a, b, c; */
+/* */
+/* a = main->elements[main->top]; */
+/* b = main->elements[main->top - 1]; */
+/* c = main->elements[main->top - 2]; */
+/* */
+/* if (a < b && b < c) */
+/* return ; */
+/* if (a < b && b > c) */
+/* stack_swap_print(main); */
+/* */
+/* if (a > b && b < c) */
+/* stack_swap_print(main); */
+/* if (a < b && b > c) */
+/* stack_swap_print(main); */
+/* if (a < b && b > c) */
+/* stack_swap_print(main); */
+/* if (a < b && b > c) */
+/* stack_swap_print(main); */
+/* } */
+
/*
** main : stack to sort
** tmp : temporary stack used to store pivot > values
@@ -94,6 +124,8 @@ static void push_swap_qsort_rec(t_stack *main, t_stack *tmp,
stack_swap_print(main);
return ;
}
+ /* if (frame_length(main main_frame) == 3) */
+ /* return push_swap_sort3(main, main_frame); */
push_swap_qsort_partition(main, tmp, main_frame);
push_swap_qsort_rec(tmp, main, tmp_frame, stack_length(main));
stack_push_to_print(main, tmp);