-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbintree.hxx
1234 lines (1013 loc) · 25 KB
/
bintree.hxx
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* bintree.hxx
*
* Created on: 16/1/2016
* Author: rshad
*/
//-*-Mode: C++;-*-
/*
************************************************************
* Implementaci��n
************************************************************
*/
/*
Funci��n de Abstracci��n:
----------------------
Dado el objeto del tipo rep r, r = {laraiz}, el objeto
abstracto al que representa es:
a) Arbol nulo, si r.laraiz.null().
b) Arbol con un ��nico nodo de etiqueta *(r.laraiz)
si r.laraiz.left().null() y r.laraiz.dcha().null()
c) *(r.laraiz)
/ \
/ \
Arbol(r.laraiz.left()) Arbol(r.laraiz.right())
Invariante de Representaci��n:
----------------------------
Si !r.laraiz.null(),
- r.laraiz.parent().null().
Para cualquier nodo n del ��rbol:
Si !n.left().null()
n.left().parent() == n;
Si !n.right().null()
n.right().parent() == n;
*/
#include <cassert>
/*____________________________________________________________ */
/*____________________________________________________________ */
// FUNCIONES PRIVADAS
/*____________________________________________________________ */
/*____________________________________________________________ */
template <typename T>
void bintree<T>::destroy(typename bintree<T>::node n)
{
if (!n.null()) {
destroy(n.left());
destroy(n.right());
n.remove();
}
}
/*____________________________________________________________ */
template <typename T>
void bintree<T>::copy(bintree<T>::node & dest, const bintree<T>::node & orig)
{
if (orig.null())
dest = typename bintree<T>::node();
else {
dest = node(*orig);
typename bintree<T>::node aux(dest.left());
copy (aux, orig.left());
dest.left(aux);
if (!dest.left().null())
dest.left().parent(dest);
aux = dest.right();
copy (aux, orig.right());
dest.right(aux);
if (!dest.right().null())
dest.right().parent(dest);
}
}
/*____________________________________________________________ */
template <typename T>
int bintree<T>::count(bintree<T>::node n) const
{
if (n.null())
return 0;
else
return 1 + count(n.left()) + count(n.right());
}
/*____________________________________________________________ */
template <typename T>
bool bintree<T>::equals(bintree<T>::node n1, bintree<T>::node n2) const
{
if (n1.null() && n2.null())
return true;
if (n1.null() || n2.null())
return false;
if (*n1 != *n2)
return false;
if (!equals(n1.left(),n2.left()))
return false;
if (!equals(n1.right(),n2.right()))
return false;
return true;
}
/*____________________________________________________________ */
/*____________________________________________________________ */
// FUNCIONES PUBLICAS
/*____________________________________________________________ */
/*____________________________________________________________ */
template <typename T>
inline
bintree<T>::bintree()
: num_nodos(0)
{
}
/*____________________________________________________________ */
template <typename T>
inline
bintree<T>::bintree(const T & e)
: laraiz(e), num_nodos(1)
{
}
/*____________________________________________________________ */
template <typename T>
inline
bintree<T>::bintree(const bintree<T> & a)
{
copy(laraiz, a.laraiz);
if (!laraiz.null())
laraiz.parent(typename bintree<T>::node());
num_nodos = a.num_nodos;
}
/*____________________________________________________________ */
template <typename T>
void bintree<T>::assign_subtree(const bintree<T> & a,
typename bintree<T>::node n)
{
if (&a != this) {
destroy(laraiz);
num_nodos = count(n);
copy(laraiz, n);
if (!laraiz.null())
laraiz.parent(typename bintree<T>::node());
} else { // Reemplazar el receptor por un sub�rbol suyo.
if (laraiz != n) {
typename bintree<T>::node nod(laraiz);
num_nodos = count(n);
laraiz = n;
if (!n.null()) {
typename bintree<T>::node aux(n.parent());
if (n.parent().left() == n)
aux.left(typename bintree<T>::node());
else
aux.right(typename bintree<T>::node());
}
destroy(nod);
laraiz.parent(typename bintree<T>::node());
}
}
}
/*____________________________________________________________ */
template <typename T>
inline
void bintree<T>::swap(bintree<T> & tree){
typename bintree<T>::node auxiliar;
auxiliar = tree.laraiz;
tree.laraiz = this->laraiz;
this->laraiz = auxiliar;
}
/*____________________________________________________________ */
template <typename T>
inline
bintree<T>::~bintree()
{
destroy(laraiz);
}
/*____________________________________________________________ */
template <typename T>
inline
bintree<T> &
bintree<T>::operator=(const bintree<T> & a)
{
if (&a != this) {
destroy(laraiz);
num_nodos = a.num_nodos;
copy(laraiz, a.laraiz);
if (!laraiz.null())
laraiz.parent(typename bintree<T>::node());
}
return *this;
}
/*____________________________________________________________ */
template <typename T>
inline
typename bintree<T>::node bintree<T>::root() const
{
return laraiz;
}
/*____________________________________________________________ */
template <typename T>
inline
void bintree<T>::prune_left(typename bintree<T>::node n,
bintree<T> & orig)
{
assert(!n.null());
destroy(orig.laraiz);
num_nodos = num_nodos - count(n.left());
orig.laraiz = n.left();
if (!orig.laraiz.null())
orig.laraiz.parent(typename bintree<T>::node());
n.left(typename bintree<T>::node());
}
/*____________________________________________________________ */
template <typename T>
inline
void bintree<T>::prune_right(typename bintree<T>::node n,
bintree<T> & orig)
{
assert(!n.null());
destroy(orig.laraiz);
num_nodos = num_nodos - count(n.right());
orig.laraiz = n.right();
num_nodos = num_nodos - count(n.right());
if (!orig.laraiz.null())
orig.laraiz.parent(typename bintree<T>::node());
n.right(typename bintree<T>::node());
}
/*____________________________________________________________ */
template <typename T>
inline
void bintree<T>::insert_left(const typename bintree<T>::node & n, const T & e)
{
bintree<T> aux(e);
insert_left(n, aux);
}
/*____________________________________________________________ */
template <typename T>
inline
void bintree<T>::insert_left(typename bintree<T>::node n,
bintree<T> & rama)
{
assert(!n.null());
num_nodos = num_nodos - count(n.left()) + rama.num_nodos;
typename bintree<T>::node aux(n.left());
destroy(aux);
n.left(rama.laraiz);
if (!n.left().null())
n.left().parent(n);
rama.laraiz = typename bintree<T>::node();
}
/*____________________________________________________________ */
template <typename T>
inline
void bintree<T>::insert_right(typename bintree<T>::node n, const T & e)
{
bintree<T> aux(e);
insert_right(n, aux);
}
/*____________________________________________________________ */
template <typename T>
inline
void bintree<T>::insert_right(typename bintree<T>::node n,
bintree<T> & rama)
{
assert(!n.null());
num_nodos = num_nodos - count(n.right()) + rama.num_nodos;
typename bintree<T>::node aux(n.right());
destroy(aux);
n.right(rama.laraiz);
if (!n.right().null())
n.right().parent(n);
rama.laraiz = typename bintree<T>::node();
}
/*____________________________________________________________ */
template <typename T>
void bintree<T>::clear()
{
destroy(laraiz);
laraiz = typename bintree<T>::node();
}
/*____________________________________________________________ */
template <typename T>
inline
typename bintree<T>::size_type bintree<T>::size() const
{
return num_nodos;
}
/*____________________________________________________________ */
template <typename T>
inline
bool bintree<T>::empty() const
{
return laraiz == bintree<T>::node();
}
/*____________________________________________________________ */
template <typename T>
inline
bool bintree<T>::operator==(const bintree<T> & a) const
{
return equals(laraiz, a.laraiz);
}
/*____________________________________________________________ */
template <typename T>
inline bool bintree<T>::operator!=(const bintree<T> & a) const
{
return !(*this == a);
}
/*
************************************************************
Iteradores
************************************************************
*/
/*
Iterador para recorrido en Preorder
*/
template <typename T>
inline
bintree<T>::preorder_iterator::preorder_iterator()
{
elnodo = typename bintree<T>::node();
}
template <typename T>
inline
bintree<T>::preorder_iterator::preorder_iterator(
const bintree<T>::preorder_iterator & i)
: elnodo(i.elnodo)
{
}
template <typename T>
inline
bintree<T>::preorder_iterator::preorder_iterator(bintree<T>::node n)
: elnodo(n)
{
}
template <typename T>
inline
bool bintree<T>::preorder_iterator::operator!=(
const bintree<T>::preorder_iterator & i) const
{
return elnodo != i.elnodo;
}
template <typename T>
inline
bool bintree<T>::preorder_iterator::operator==(
const bintree<T>::preorder_iterator & i) const
{
return elnodo == i.elnodo;
}
template <typename T>
inline
typename bintree<T>::preorder_iterator &
bintree<T>::preorder_iterator::operator=( const bintree<T>::preorder_iterator & i)
{
elnodo = i.elnodo;
return *this;
}
template <typename T>
inline
T & bintree<T>::preorder_iterator::operator*()
{
return *elnodo;
}
template <typename T>
typename bintree<T>::preorder_iterator &
bintree<T>::preorder_iterator::operator++()
{
if (elnodo.null())
return *this;
if (!elnodo.left().null())
elnodo = elnodo.left();
else if (!elnodo.right().null())
elnodo = elnodo.right();
else {
while ((!elnodo.parent().null()) &&
(elnodo.parent().right() == elnodo ||
elnodo.parent().right().null()))
elnodo = elnodo.parent();
if (elnodo.parent().null())
elnodo = typename bintree<T>::node();
else
elnodo = elnodo.parent().right();
}
return *this;
}
template <typename T>
inline
typename bintree<T>::preorder_iterator
bintree<T>::begin_preorder()
{
return preorder_iterator(laraiz);
}
template <typename T>
inline
typename bintree<T>::preorder_iterator
bintree<T>::end_preorder()
{
return preorder_iterator(typename bintree<T>::node());
}
/*____________________________________________________________ */
/*
Iterador para recorrido en Inorder
*/
template <typename T>
inline
bintree<T>::inorder_iterator::inorder_iterator()
{
}
template <typename T>
inline bintree<T>::inorder_iterator::inorder_iterator(
bintree<T>::node n)
: elnodo(n)
{
}
template <typename T>
inline bool bintree<T>::inorder_iterator::operator!=(
const typename bintree<T>::inorder_iterator & i) const
{
return elnodo != i.elnodo;
}
template <typename T>
inline bool bintree<T>::inorder_iterator::operator==(
const typename bintree<T>::inorder_iterator & i) const
{
return elnodo == i.elnodo;
}
template <typename T>
inline
typename bintree<T>::inorder_iterator &
bintree<T>::inorder_iterator::operator=(
const bintree<T>::inorder_iterator & i)
{
elnodo = i.elnodo;
return *this;
}
template <typename T>
inline T & bintree<T>::inorder_iterator::operator*()
{
return *elnodo;
}
template <typename T>
typename bintree<T>::inorder_iterator &
bintree<T>::inorder_iterator::operator++()
{
if (elnodo.null())
return *this;
if (!elnodo.right().null()) {
elnodo = elnodo.right();
while (!elnodo.left().null())
elnodo = elnodo.left();
}
else {
while (!elnodo.parent().null() &&
elnodo.parent().right() == elnodo)
elnodo = elnodo.parent();
// Si (padre de elnodo es nodo_nulo), hemos terminado
// En caso contrario, el siguiente node es el padre
elnodo = elnodo.parent();
}
return *this;
}
template <typename T>
typename bintree<T>::inorder_iterator
bintree<T>::begin_inorder()
{
node n(laraiz);
if (!n.null())
while (!n.left().null())
n = n.left();
return inorder_iterator(n);
}
template <typename T>
inline
typename bintree<T>::inorder_iterator
bintree<T>::end_inorder()
{
return inorder_iterator(typename bintree<T>::node());
}
/*____________________________________________________________ */
/*
Iterador para recorrido en Postorder
*/
template <typename T>
inline
bintree<T>::postorder_iterator::postorder_iterator()
{
}
template <typename T>
inline
bintree<T>::postorder_iterator::postorder_iterator(
bintree<T>::node n)
: elnodo(n)
{
}
template <typename T>
inline
bool bintree<T>::postorder_iterator::operator!=(
const bintree<T>::postorder_iterator & i) const
{
return elnodo != i.elnodo;
}
template <typename T>
inline
bool bintree<T>::postorder_iterator::operator==(
const bintree<T>::postorder_iterator & i) const
{
return elnodo == i.elnodo;
}
template <typename T>
inline
typename bintree<T>::postorder_iterator &
bintree<T>::postorder_iterator::operator=(
const bintree<T>::postorder_iterator & i)
{
elnodo = i.elnodo;
return *this;
}
template <typename T>
inline
T & bintree<T>::postorder_iterator::operator*()
{
return *elnodo;
}
template <typename T>
typename bintree<T>::postorder_iterator &
bintree<T>::postorder_iterator::operator++()
{
if (elnodo.null())
return *this;
if (elnodo.parent().null())
elnodo = typename bintree<T>::node();
else
if (elnodo.parent().left() == elnodo) {
if (!elnodo.parent().right().null()) {
elnodo = elnodo.parent().right();
do {
while (!elnodo.left().null())
elnodo = elnodo.left();
if (!elnodo.right().null())
elnodo = elnodo.right();
} while ( !elnodo.left().null() ||
!elnodo.right().null());
}
else
elnodo = elnodo.parent();
}
else // elnodo es hijo a la derecha de su padre
elnodo = elnodo.parent();
return *this;
}
template <typename T>
inline
typename bintree<T>::postorder_iterator bintree<T>::begin_postorder()
{
node n(laraiz);
do {
while (!n.left().null())
n = n.left();
if (!n.right().null())
n = n.right();
} while (!n.left().null() || !n.right().null());
return postorder_iterator(n);
}
template <typename T>
inline
typename bintree<T>::postorder_iterator
bintree<T>::end_postorder()
{
return postorder_iterator(typename bintree<T>::node());
}
/*____________________________________________________________ */
/*
Iterador para recorrido por Niveles
*/
template <typename T>
inline
bintree<T>::level_iterator::level_iterator()
{
}
template <typename T>
inline bintree<T>::level_iterator::level_iterator(
bintree<T>::node n)
{
cola_Nodos.push(n);
}
template <typename T>
inline bool bintree<T>::level_iterator::operator!=(
const bintree<T>::level_iterator & i) const
{
if (cola_Nodos.empty() && i.cola_Nodos.empty())
return false;
if (cola_Nodos.empty() || i.cola_Nodos.empty())
return true;
if (cola_Nodos.front() != i.cola_Nodos.front())
return false;
if (cola_Nodos.size() != i.cola_Nodos.size())
return false;
return (cola_Nodos == i.cola_Nodos);
}
template <typename T>
inline
bool bintree<T>::level_iterator::operator==(
const bintree<T>::level_iterator & i) const
{
return !(*this != i);
}
template <typename T>
inline
typename bintree<T>::level_iterator &
bintree<T>::level_iterator::operator=(
const bintree<T>::level_iterator & i)
{
cola_Nodos = i.cola_Nodos;
return *this;
}
template <typename T>
inline
T & bintree<T>::level_iterator::operator*()
{
return *cola_Nodos.front();
}
template <typename T>
typename bintree<T>::level_iterator &
bintree<T>::level_iterator::operator++()
{
if (!cola_Nodos.empty()) {
typename bintree<T>::node n = cola_Nodos.front();
cola_Nodos.pop();
if (!n.left().null())
cola_Nodos.push(n.left());
if (!n.right().null())
cola_Nodos.push(n.right());
}
return *this;
}
template <typename T>
inline typename bintree<T>::level_iterator
bintree<T>::begin_level()
{
if (!root().null())
return level_iterator(laraiz);
else
return level_iterator();
}
template <typename T>
inline typename bintree<T>::level_iterator
bintree<T>::end_level()
{
return level_iterator();
}
/*
************************************************************
Iteradores constantes
************************************************************
*/
/*
Iterador cosntante para recorrido en Preorder
*/
template <typename T>
inline
bintree<T>::const_preorder_iterator::const_preorder_iterator()
{
}
template <typename T>
inline
bintree<T>::const_preorder_iterator::const_preorder_iterator(
bintree<T>::node n)
: elnodo(n)
{
}
template <typename T>
inline
bool bintree<T>::const_preorder_iterator::operator!=(
const bintree<T>::const_preorder_iterator & i) const
{
return elnodo != i.elnodo;
}
template <typename T>
inline
bool bintree<T>::const_preorder_iterator::operator==(
const bintree<T>::const_preorder_iterator & i) const
{
return elnodo == i.elnodo;
}
template <typename T>
inline
typename bintree<T>::const_preorder_iterator &
bintree<T>::const_preorder_iterator::operator=(
const bintree<T>::const_preorder_iterator & i)
{
elnodo = i.elnodo;
return *this;
}
template <typename T>
inline
const T & bintree<T>::const_preorder_iterator::operator*() const
{
return *elnodo;
}
template <typename T>
typename bintree<T>::const_preorder_iterator &
bintree<T>::const_preorder_iterator::operator++()
{
if (elnodo.null())
return *this;
if (!elnodo.left().null())
elnodo = elnodo.left();
else if (!elnodo.right().null())
elnodo = elnodo.right();
else {
while ((!elnodo.parent().null()) &&
(elnodo.parent().right() == elnodo
|| elnodo.parent().right().null()))
elnodo = elnodo.parent();
if (elnodo.parent().null())
elnodo = typename bintree<T>::node();
else
elnodo = elnodo.parent().right();
}
return *this;
}
template <typename T>
inline
typename bintree<T>::const_preorder_iterator
bintree<T>::begin_preorder() const
{
return const_preorder_iterator(laraiz);
}
template <typename T>
inline
typename bintree<T>::const_preorder_iterator
bintree<T>::end_preorder() const
{
return const_preorder_iterator(typename bintree<T>::node());
}
/*____________________________________________________________ */
/*
Iterador constante para recorrido en Inorder
*/
template <typename T>
inline
bintree<T>::const_inorder_iterator::const_inorder_iterator()
{
elnodo = typename bintree<T>::node();
}
template <typename T>
inline
bintree<T>::const_inorder_iterator::const_inorder_iterator(const const_inorder_iterator &i)
{
elnodo = i.elnodo;
}
template <typename T>
inline
bintree<T>::const_inorder_iterator::const_inorder_iterator(
bintree<T>::node n)
: elnodo(n)
{
}
template <typename T>
inline
bool bintree<T>::const_inorder_iterator::operator!=(
const bintree<T>::const_inorder_iterator & i) const
{
return elnodo != i.elnodo;
}
template <typename T>
inline
bool bintree<T>::const_inorder_iterator::operator==(
const bintree<T>::const_inorder_iterator & i) const
{
return elnodo == i.elnodo;
}
template <typename T>
inline
typename bintree<T>::const_inorder_iterator &
bintree<T>::const_inorder_iterator::operator=(
const bintree<T>::const_inorder_iterator & i)
{
elnodo = i.elnodo;
return *this;
}
template <typename T>
inline
const T & bintree<T>::const_inorder_iterator::operator*() const
{
return *elnodo;
}
template <typename T>
typename bintree<T>::const_inorder_iterator &
bintree<T>::const_inorder_iterator::operator++()
{
if (elnodo.null())
return *this;
if (!elnodo.right().null()) {
elnodo = elnodo.right();
while (!elnodo.left().null())
elnodo = elnodo.left();
}
else {
while (!elnodo.parent().null() &&
elnodo.parent().right() == elnodo)
elnodo = elnodo.parent();
// Si (el padre de elnodo es nodo_nulo), hemos terminado
// En caso contrario, el siguiente Nodo es el padre
elnodo = elnodo.parent();
}
return *this;
}
template <typename T>
inline
typename bintree<T>::const_inorder_iterator
bintree<T>::begin_inorder() const
{
node n(laraiz);
if (!n.null())
while (!n.left().null())
n = n.left();
return const_inorder_iterator(n);
}
template <typename T>
inline
typename bintree<T>::const_inorder_iterator
bintree<T>::end_inorder() const
{
return const_inorder_iterator(typename bintree<T>::node());
}
/*____________________________________________________________ */
/*
Iterador constante para recorrido en Postorder
*/
template <typename T>
inline
bintree<T>::const_postorder_iterator::const_postorder_iterator()