83ff4c0136c878429487a9ec7e652bd975691aaf
[reactos.git] / reactos / lib / rtl / splaytree.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * PURPOSE: Splay-Tree implementation
5 * FILE: lib/rtl/splaytree.c
6 * PROGRAMMER:
7 */
8
9 /* INCLUDES *****************************************************************/
10
11 #include <rtl.h>
12
13 #define NDEBUG
14 #include <debug.h>
15
16 /* FUNCTIONS ***************************************************************/
17
18 /*
19 * @unimplemented
20 */
21 PRTL_SPLAY_LINKS
22 NTAPI
23 RtlDelete (
24 PRTL_SPLAY_LINKS Links
25 )
26 {
27 UNIMPLEMENTED;
28 return 0;
29 }
30
31 /*
32 * @unimplemented
33 */
34 VOID
35 NTAPI
36 RtlDeleteNoSplay (
37 PRTL_SPLAY_LINKS Links,
38 PRTL_SPLAY_LINKS *Root
39 )
40 {
41 UNIMPLEMENTED;
42 }
43
44
45 /*
46 * @unimplemented
47 */
48 PRTL_SPLAY_LINKS
49 NTAPI
50 RtlRealPredecessor (
51 PRTL_SPLAY_LINKS Links
52 )
53 {
54 UNIMPLEMENTED;
55 return 0;
56 }
57
58 /*
59 * @unimplemented
60 */
61 PRTL_SPLAY_LINKS
62 NTAPI
63 RtlRealSuccessor (
64 PRTL_SPLAY_LINKS Links
65 )
66 {
67 UNIMPLEMENTED;
68 return 0;
69 }
70
71 /*
72 * @unimplemented
73 */
74 PRTL_SPLAY_LINKS
75 NTAPI
76 RtlSplay (
77 PRTL_SPLAY_LINKS Links
78 )
79 {
80 UNIMPLEMENTED;
81 return 0;
82 }
83
84
85 /*
86 * @implemented
87 */
88 PRTL_SPLAY_LINKS NTAPI
89 RtlSubtreePredecessor (IN PRTL_SPLAY_LINKS Links)
90 {
91 PRTL_SPLAY_LINKS Child;
92
93 Child = Links->RightChild;
94 if (Child == NULL)
95 return NULL;
96
97 if (Child->LeftChild == NULL)
98 return Child;
99
100 /* Get left-most child */
101 while (Child->LeftChild != NULL)
102 Child = Child->LeftChild;
103
104 return Child;
105 }
106
107 /*
108 * @implemented
109 */
110 PRTL_SPLAY_LINKS NTAPI
111 RtlSubtreeSuccessor (IN PRTL_SPLAY_LINKS Links)
112 {
113 PRTL_SPLAY_LINKS Child;
114
115 Child = Links->LeftChild;
116 if (Child == NULL)
117 return NULL;
118
119 if (Child->RightChild == NULL)
120 return Child;
121
122 /* Get right-most child */
123 while (Child->RightChild != NULL)
124 Child = Child->RightChild;
125
126 return Child;
127 }
128
129 /* EOF */