comparison src/llrb/compare.c @ 81:dc6f665bb753

implement delete(tail call). do not work
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Fri, 11 Dec 2015 15:06:20 +0900
parents 368306e1bfed
children
comparison
equal deleted inserted replaced
80:099d85f9d371 81:dc6f665bb753
1 #include "llrbContext.h" 1 #include "llrbContext.h"
2 2
3 void compare(struct Context* context, struct Tree* tree, int key1, int key2) { 3 void compare(struct Context* context, struct Tree* tree, int key1, int key2) {
4 if (key1 == key2) { 4 if (key1 == key2) {
5 tree->result = 0; 5 tree->result = EQ;
6 } else if (key1 < key2) { 6 } else if (key1 < key2) {
7 tree->result = 1; 7 tree->result = GT;
8 } else { 8 } else {
9 tree->result = -1; 9 tree->result = LT;
10 } 10 }
11 } 11 }