Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
btreepic_avl.H
Go to the documentation of this file.
1
2/*
3 Aleph_w
4
5 Data structures & Algorithms
6 version 2.0.0b
7 https://github.com/lrleon/Aleph-w
8
9 This file is part of Aleph-w library
10
11 Copyright (c) 2002-2026 Leandro Rabindranath Leon
12
13 Permission is hereby granted, free of charge, to any person obtaining a copy
14 of this software and associated documentation files (the "Software"), to deal
15 in the Software without restriction, including without limitation the rights
16 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 copies of the Software, and to permit persons to whom the Software is
18 furnished to do so, subject to the following conditions:
19
20 The above copyright notice and this permission notice shall be included in all
21 copies or substantial portions of the Software.
22
23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 SOFTWARE.
30*/
31
32
43# include <tpl_avl.H>
44
45
46 template <class Node>
48{
49 ofstream & output;
50
51 Preorder_Nodes(ofstream & out)
52 : output(out)
53 {
54 output << "start-prefix ";
55 }
56
58 {
59 output << std::endl
60 << std::endl;
61 }
62
64 {
65 output << (long) p << " ";
66 }
67};
68
69 template <class Node>
71{
72 ofstream & output;
73
74 Inorder_Nodes(ofstream & out) : output(out)
75 {
76 output << "start-infix ";
77 }
78
80 {
81 output << std::endl
82 << std::endl;
83 }
84
86 {
87 output << (long) p << " ";
88 }
89};
90
91 template <class Node, class Key>
93{
94 ofstream & output;
95
96 Inorder_Keys(ofstream & out) : output(out)
97 {
98 output << "start-key ";
99 }
100
102 {
103 output << std::endl
104 << std::endl;
105 }
106
108 {
109 output << Key () (KEY(p)) << " ";
110 }
111};
112
113 template <class Node>
115{
116 ofstream & output;
117
118 Inorder_Diff(ofstream & out) : output(out)
119 {
120 output << "start-aux ";
121 }
122
124 {
125 output << std::endl
126 << std::endl;
127 }
128
130 {
131 output << (int) DIFF(p) << " ";
132 }
133};
134
135
136
137 template <class Node, class Key_To_Text>
161
#define DIFF(p)
Access the balance factor of node p.
Definition avlNode.H:95
WeightedDigraph::Node Node
@ KEY
Definition btreepic.C:169
void avl_to_btreepic(Node *root, ofstream &output)
__gmp_expr< T, __gmp_binary_expr< __gmp_expr< T, U >, unsigned long int, __gmp_root_function > > root(const __gmp_expr< T, U > &expr, unsigned long int l)
Definition gmpfrxx.h:4060
DynList< T > maps(const C &c, Op op)
Classic map operation.
ofstream & output
Inorder_Diff(ofstream &out)
void operator()(Node *p)
void operator()(Node *p)
ofstream & output
Inorder_Keys(ofstream &out)
void operator()(Node *p)
ofstream & output
Inorder_Nodes(ofstream &out)
Preorder_Nodes(ofstream &out)
ofstream & output
void operator()(Node *p)
AVL tree implementation (height-balanced BST).
void preorder(int v[], int n, int i)
Write preorder traversal of heap.
Definition writeHeap.C:222
ofstream output
Definition writeHeap.C:213
void inorder(int v[], int n, int i)
Write inorder traversal of heap.
Definition writeHeap.C:242