-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreplace_node.c
30 lines (26 loc) · 1.16 KB
/
replace_node.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* replace_node.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: srakuma <srakuma@student.42tokyo.jp> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/28 00:11:51 by srakuma #+# #+# */
/* Updated: 2023/03/04 23:11:41 by srakuma ### ########.fr */
/* */
/* ************************************************************************** */
#include "avl_tree.h"
void replace_node(t_avl *a, t_avl *b)
{
if ((a == NULL) || (b == NULL))
return ;
a->depth ^= b->depth;
b->depth ^= a->depth;
a->depth ^= b->depth;
a->depth ^= b->key;
b->key ^= a->key;
a->key ^= b->key;
a->val ^= b->val;
b->val ^= a->val;
a->val ^= b->val;
}