-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeq_get_value_bonus.c
47 lines (41 loc) · 1.31 KB
/
deq_get_value_bonus.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* deq_get_value_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sanglee2 <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/20 04:01:57 by sanglee2 #+# #+# */
/* Updated: 2023/05/27 23:02:04 by sanglee2 ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap_bonus.h"
#include <limits.h>
int get_max_value(t_deq *deq)
{
t_node *temp;
int max;
temp = deq->a_top;
max = INT_MIN;
while (temp)
{
if (max < temp->index)
max = temp->index;
temp = temp->next;
}
return (max);
}
int get_min_value(t_deq *deq)
{
t_node *temp;
int min;
temp = deq->a_top;
min = INT_MAX;
while (temp)
{
if (min > temp->index)
min = temp->index;
temp = temp->next;
}
return (min);
}