Tema 5. Árboles no binarios

Anuncio
!
"
$
' %
%
#
!
&
)
#'
!
' %
+
%
+ #'
+
%
-
(
' %
' %
' %
)
*" &
"(
'
!
'
#
)
+
#
+
"
' %
+ "(
' %
,
+ ' %
' %
!
#'
#'
#' (
#' (
!
-
%-
$
*
$ ./ 0
(
(
)(
(
!
%
/12(
%
" )
% " )
!
(
-!
%
,
/12
3(
)
0
(
4
4
5(
*"5
$
(
+
$4
$ ≥ /5(
+ *5
4 ( 5(
( 6
(
6 *
4(
-
!
#
(
+ *
(
! (
(
(
(
4
( 5
'
+ *(
(
!
!
!
%
" #$# #%
,
%
,
/
87
$( %
#'
$ 7
8$ 7
)
! %
) ! (
$
$+ *
!
*"
!
9
*"(
(
#'
!
!
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
: *" 7
) !
+ +
*"
)
(
+ *
/
;'
7
) !
+ +
)
!
+
?<$ 7( :, :7(
5
,
$
9
+ * <
)
# ' 4&:=> :7(
)
)
(
)
8@ *( !
(
!
,
3 ! $
/
,
$
,
7
7
) ! %
(!
%
!
!
) ! %
!
$+ *
+
9
"
7
) !
&
&"
'
(
#'
+ *
,
(#
2
9
+ +
) !
9
#'
!
*
37 A< $
$( :37B$
,
,
#&
,
3 ! $ → 37 A< $
37 A< $ × $ × :37B$  → 37 A< $
37 A< $ × $  → :37B$
)
> 6 → $
#
3 37 A< $C $C
:37B$
,
43( ( 5 ≤ ≤ > 6
,
43( 5 ≤ ≤ > 6
# #
3 37 A< $C ( / $C ( / :37B$
> 6..
4 5
,
4 ,
43( ( 5( /( /5 ..
= . / $ 7$,
,
43( /( /5
=$7
,
4 ,
43( /( /5( ( 5
,
4,
3 ! $( 5 .. ,
$
,
4 ,
43( ( 5( /5 ..
= . / $ 7$,
" #
=$7
,
43( /5
$
/
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
:37B$
B > $ 7( B7?=,7( $( 37 A< $
&"
'
(
,
87
$ → :37B$
8$ B > $ 7 × 37 A< $ → :37B$
#
& #&
; ' $ × :37B$  → :37B$
#&
: *" :37B$  → B > $ 7
8@ * :37B$ → B7?=,7
)
> 6 → $
" #
#
:37B$C $C
: *"4 5
8@ *4 5
;' 4 ( 5
8@ *4 5
≤ ≤ > 6
# #
:37B$C3 37 A< $C ( ( / $C B > $ 7C
> 6..
4 5
8@ *4,
$5 .. @
8@ *4
87
8$4 ( 355 .. 0
: *"4
87
8$4 ( 355 ..
;' 4(
87
8$4 ( 355 .. ,
43( 5
$
)
D
,
)
=%
$
)
) !
37 A< $
%
80
(
) !
!
+ + @ :
!
:7
=% 80
:37B$ × :37B$ → B7?=,7
=% 80
3 $ × 37 A< $ × 37 A< $  → B7?=,7
" =% 80
34 ( 35 ≤ ≤ > 6
=%
=%
=%
80
80
80
=%
4,
4
4
80
=%
80
34 ( 3 ( 3/5 .. = . $ $
=%
=$7
=%
=%
$$-
8$
8$
$( 5 .. 8@ *4 5
87
8$4 ( 35( ,
$5 .. 0
87
8$4 ( 3 5(
87
8$4 /( 3/55 ..
34 ( 3 ( 3/5
) !
:37B$ → $
7$,
80
80
80
+ +
2
4,
43 ($5( ,
4,
43 ( 5( ,
34 4 5( 3 ( 3/55
43/( $55
43/( 55 $
-
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
$8$
3 $ × 37 A< $  → $
" $8$
34 ( 35 ≤ ≤ > 6
$8$
4,
$5 ..
$8$
4
87
8$4 ( 355 .. F $$8$
34 ( 35 ..
= . $ $ 7$,
$8$
=$7
$8$
) !
4,
43($55
4,
43( 55 F $-
+ +
6
8$
8$
34 ( 35
34
4 5( 35
%
*"
# '
:37B$ → $
3 $ × 37 A< $  → $
> 6
$ → $
"
34 ( 35 ≤ ≤ > 6
> 6 4 ( 5 ..
= G $ 7$,
=$7
4,
4
87
$5 ..
8$4 ( 355 .. F
3435 .. = . $ $ 7$,
4,
=$7
> 6 4
) !
3435
43($55
4,
43( 55(
+ + @ :
34
4 5( 355
:7
B > $ 7 × :37B$ → B7?=,7
3 $ × B > $ 7 × 37 A< $  → B7?=,7
"
34 ( 35 ≤ ≤ > 6
4 (,
$5 .. 0
4 (
87
8$4 ( 355 .. 4 . 5 7:
34 ( ( 35
34 ( ( 35 ..
= . $ $ 7$,
4 (,
43( $55
=$7
4 (,
=%
) !
43( 55 7:
+ + @ :
4 5( ( 35
:7
(
% 9 ( ! 6%
)
! +
=%
:37B$ × :37B$ → B7?=,7
=% 3 $ × 37 A< $ × 37 A< $  → B7?=,7
" =% 34 ( 35 ≤ ≤ > 6
E
34
$
= >
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
=%
=%
=%
4,
$( 5 .. 8@ *4 5
4
87
8$4 ( 5( ,
$5 .. 0
4
87
8$4 ( 3 5(
87
8$4 /( 3/55 ..
4 . /5 $ =% 34 ( 3 ( 3/5
=%
34 ( 3 ( 3/5 .. = . $ $ 7$,
=%
4,
43 ( $5( ,
=$7
=%
4,
43 ( 5( ,
=% 34 4 5( 3 ( 3/5
&
$
) !
43/( $55
43/( 55 $
+ +
9
#'
&
&
" &
&
&
:37B$ → B=
3 $ × 37 A< $  → B=
34 ( 35 ≤ ≤ > 6
4,
$5 .. ,
4
87
8$4 ( 355 .. ,
&
34 ( 35 ..
* +'" '
4 (&
+
& #%
&#
B
!
34355
$
"
%
= . $ $ 7$,
&
4,
43( $55
=$7
,
4 &
4,
43( 55(
&
34 4 5( 355
B
*
*"
%
'#
)
%
+
#'
"
(
+"
*(
)
+
B
CONS
TYPE
% %
*
#'
%
MAX = ...........;
ARBOLN = POINTER TO ESTRUCTURA;
ESTRUCTURA = RECORD
raiz: ELEMENTO;
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
END;
bosque: ARRAY [1 .. MAX] OF ARBOLN;
0
H
B
A
I
:
,(
#
& #&
'# -
- "
!
"
#'
! #
(
)
B
CONS
TYPE
!
%
!
+
!
)
#
*
*"
#'
%
MAX_HIJOS = ...........;
ARBOLN = POINTER TO ESTRUCTURA;
LISTAN = POINTER TO NODOLISTA;
ESTRUCTURA = RECORD
raiz: ELEMENTO;
bosque: LISTAN;
END;
NODOLISTA =
RECORD
posicion: [1.. MAX_HIJOS];
hijo: ARBOLN;
sig := LISTAN;
END;
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
2
0
E
H
A
2
/
B
,(
**
I
*
"
$(
!
&#
:
&
&
& &#
)
*
+
+
(
+
*
%
D
7
(
6
) -
#
-
#'
)
)(
%
,
!
!
)
9
!
! #
+
9
!
)
#'
!
!
+
)
)
) $'1 F 4 1 5
) K =@ $
19
#'
+
"
19
'19
) K
) 4$ LK5 F 4 1
/5
&
!
(
%
!
+
CONS
TYPE
!
*
9 + *(
%
ALTURA_MAX = ..........;
MAX_NODOS = 2**ALTURA_MAX - 1;
J
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
ARBOLN = POINTER TO ESTRUCTURA;
ESTRUCTURA = ARRAY [1 .. MAX] OF PAR;
PAR = RECORD
libre: BOOLEAN;
valor: ELEMENTO;
END;
0
H A
,(
.
B I
$(
&
"
&
:
$ '
"
# #
*
(
<
%
5
4 ( 5(
B
#'
!
%
+ * ,
(
%
+
#
!
$)
! #
'
+"
+ *(
!
%
%
% *
+ * ! (
+
)
+ *(
* %
!
+ *
'
4
#'
)(
(
*"
*
!
%
" #$# #%
+ +
:
)
!
!
&"
'
(
%
(
#'
(
) : *"!
#'
37 A<
!
!
%
+ *
%
-
!
!
6
*
!
(
,
) %
!
+ +
? ( !
,
*"
) ;'
)
+ *
+ +
+ (
%
(
%
D
!
!
)
!
+ *
37 A< ?
$( :37B?
,
3 ! ? → 37 A< ?
M
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
=
:37B? × 37 A< ? → 37 A< ?
& #&
:
37 A< ? → 37 A< ?
#&
&
37 A< ?  → :37B?
3 ! ?@ * 37 A< ? → B7?=,7
" #
#
3 37 A< ?C $C
:37B?
&
435
3 ! ?@ *435
# #
3 37 A< ?C
:37B?
3 ! ?@ *4,
3 ! ?5 ..
@
3 ! ?@ *4=
4 ( 355 ..
0
&
4=
4 ( 355 ..
:
4,
3 ! ?5 .. ,
3 ! ?
:
4=
4 ( 355 ..
3
$
#
&"
'
(
:37B?
B > $ 7( B7?=,7( $( 37 A< %
?
B > $ 7 × 37 A< ? → :37B?
#&
: *" :37B? → B > $ 7
;'
:37B? → 37 A< ?
# #
:37B?C3 37 A< ?C
: *"4
? 4 ( 355 ..
;' 4
? 4 ( 355 .. 3
$
$)
! (
*"
B > $ 7C
6
#'
%
!
(
+ *(
!
$
)
D
,
)
!
-
)
!
*
#' !
) !
37 A< ?
%
!
%
$
D
) ?
(!
)
+ +
!
=% 80
:37B? × :37B? → B7?=,7
=% 80
3 37 A< ? × 37 A< ? → B7?=,7
$8$
:37B? → $
$8$
3 37 A< ? → $
:37B? → $
3 37 A< ? → $
?
:37B? → $
?
3 37 A< ? → $
B %
37 A< ? → $
N
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
=%
=%
&
&
B > $ 7 × :37B? → B7?=,7
B > $ 7 × 37 A< ? → B7?=,7
:37B? × :37B? → B7?=,7
3 37 A< ? × 37 A< ? → B7?=,7
:37B? → B=
3 37 A< ? → B=
=%
80
=%
=%
=%
=%
80
80
80
80
=%
3
$$$-
4
34,
34,
34=
34=
80
8$
8$
8$
? 4 ( 3/55 .. =%
? 4 ( 355 .. F $3 ! ?5 ..
4 (355 .. $8$
? 4 ( 355 .. F
3 ! ?5 ..
4 (355 .. > 6
4,
4=
4
? 4 ( 355 .. > 6
%
4
?
?
34,
34=
3 ! ?5 ..
4 (355 .. > 6
4(
? 4 ( 355 .. 4 . 5 7:
4
=%
=%
=%
=%
34,
34,
34=
34=
=%
3 ! ?5 .. 0
4 (355 ..
? 4 ( 3 5(
8$
3 435
4 5 F $-
4 5(
?
=%
343 ( 3/5
8$
3435
3435
3 ! ?5 ..
4 ( 355 .. F B
34 ( ,
34 ( =
80
3 ! ?( ,
3 ! ?5 .. @
3 ! ?( =
4 (355 .. 0
4 (35( ,
3 ! ?5 .. 0
4 (3 5( =
4 /(3/55 ..
4 ( /5 $ =% 80
343 ( 3/5
4
34,
34=
4
34,
34=
B %
B %
? 4 ( 3 5(
34355
435
4B %
4?
435( ?
4 5( ?
34355
34355
34 ( 35
4 ( 5 7:
34 ( 35
? 4 ( 3/55 .. 4 . 5 $ =%
343 ( 3/5
3 ! ?( ,
3 ! ?5 .. @
3 ! ?( =
4 (355 .. 0
4 (35( ,
3 ! ?5 .. 0
4 (3 5( =
4 /(3/55 ..
4 ( /5 $ =% 343 ( 3/5
&
4
? 4 ( 355 .. ,
&
&
34,
34=
3 ! ?5 .. ,
4 (355 .. ,
4 (&
4&
34355
4 5( &
34355
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
** +'" '
& #%
&
(
%
+
(
**
-
"
"
& #%
&
)
"
%
!
B
#'
*
TYPE
+
%
ARBOLG = POINTER TO ESTRUCTURA;
LISTAG = POINTER TO NODOLISTA;
ESTRUCTURA = RECORD
raiz: ELEMENTO;
bosque: LISTAG;
END;
NODOLISTA =
RECORD
cont: ARBOLG;
sig := LISTAG;
END;
,
)
#'
!
!
0
H
B
,(
/
$(
A
I
#'
:
(
'
&
&
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
***
"
& #%
)
%
-
+9
!
!
#'
"!
#'
#
#
!
B
#
*"
! (
#'
-
!
#'
!
#'
!
%
$=B 3
%
#'
#'
,
)
!
9
+
D
7
!
!
(
)
!
%
#
(
+
+
#'
9
!
#
+ * &
+
:7
+"
D
@ :
#'
#
!
!
%
#'
)
#
0 B 7
0
0
B
0
,(
.
0
+'" '
H
I
0
0
& #%
0 &'
A
:
&
" &
'
"
*1.
,
+
(
"
-!
!
-!
"
-!
(
/
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
+"
-
#
+
#
+
)
+
%/4 5
!
.
@B !
$ #%
<
+
*
+
*
"
%
"
3( !
!
)
!
%
-!
)
%
!
(!
O
+
" !
(
(
%
-!
%
+
!
(
+
%
*
(
+
(
+
)
"
*1.
/12
!
%
#'
(
-!
/12(
*
#
+
*
!
%
&
(
/ )2 # '
-!
#
# '
#
+
/12
•
+ *4
•
/12
4(
(
5(
4(
(
(
5(
/12
(
•
5(
(
/12
#'
#'
&
-!
!
<
+
/12
•
(
!
)
-!
+ *(
•
4(
(
5(
(
/12
-!
!
(
!
•
4(
/12
!
( (
-!
5(
4
(
/5(
(
!
2
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
!
!
)
-
!
-
#'
!
!
# '
#
/12
-!
/12
N
/
J
2
,(
E
M
2
*1.
.* 0
2
E
0
*1.
B -!
(
)
%
!
/12
%
-!
&
#
/
9
/12(
%
!
"
# '
*"
!
+
'
%
+
)
*"
+ *(
%
+ *(
*"(
(
# ' (
%
# '
!
(
#
#'
"!
!
!
%
(
/
#'
≤ /5
4
!
#'
/
,
/12
-
(
-!
) #
# (
%
(
!
!
/(
-!
#'
(
#'
"!
#
#
!
-!
'
#
(
!
!
!
74 %/4 55
E
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
.. +
#%
*1.
#
!
%
+
/12
%
@
'
)
2
J
/
,(
3
%
!
-!
E
&
%
&
!
(
2N +
2N #
-!
!
E ,
) #
)
2
/
,(
4
J
2N
E
B !
PE Q
$(
&
#'
&
&
& .5
P2N( E Q(
#
+
(
P2 ( 2NQ(
N
M
2M( *
+
P2MQ
2N ,
# '
"
!
(
D
N
M
*1.
%
PE Q
!
B
+
(
#
P2MQ
#
P2M( 2N( E Q
2N(
+
#'
9
(
#
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
2
2N
/
,(
J
2M
5
E
*1.
)
(
M
$(
#
+ )
2J
(
N
&
&
(
&
& .4
+
#
)
!
(
2 (
*!
2M
!
*
%-
%
2J
2
/
,(
2
6
B
*" ,
P Q P2Q
2N
2M
$(
J
E
M
&
&
&
+
*"
%
P(
+
/12
N
*"( !
( #
(
2Q
/
#
+
)
(
& .3-.2
#
%
+
P/Q
+ *"
(
)
$
3
3
3,
$
# '
3,
,
,
0
?
0
?
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
$ + : *"
: *"
0
,(
./
#%
B
)
0
&
?
#%
'
&
*1.
%
)
/12
)
+
+
%
#
!
*"
)
6
,
?
7 %
'
3
#F
#
3,
(
!
)
!
+ *
#
#
#' (
!
+ *
9 #
+
*"
%
+
B
"
(
+
# ' &
!
#
+
)
(
+
%
#
(
)
(
!
%
+
! !
# '
(
,
(
! (
"
# '
)
# '
(
#
(
<
!
"
-
+"
4 *
(9
/12 &
,
!
-
%
!
(
#
) #
+ *(
!
#' (
+
( #*
) !
# !
+ *
9
!
!
(#
5(
+
#
+
9
J
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
(!
#'
*(
-
#'
#'
+
;
! #
!
# !
#
% (
+
+ *
#
*"
(
#
!
+ *
#
4)
!
*
*
5(
!
(
# %
*"
#'
%
-
#
%
#
!
)
!
! )
!
%
+ *(
+
!
+
+ *
%
#'
B
&
)(
J (
%
M
2N
2M
,(
*
,
( M
J
E
!
(
N
M
*1.
&
J
!
J (
#
*"
*"
# ' (
PM ( N Q
%
*
+ *
# ' ( P Q( PJ Q P
#
+ !
%
!
)
'
!
,
%
!
(
%- #
P Q
'
Q
(
!
2N
2M
,(
.
!
+ *(
(
'
P Q
N
E
M
$(
&
#
9
#
B
!
+
&
& 36
(!
!
#
!
PN Q
M
(#
M
# '
) ,
!
+
!
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
2N
2M
,(
M
E
/
N
$(
,
&
&
M
(
(
#
( 9
#
!
(
(!
!
& 66
+ *(
+
N
M
! # !
!
'
# '
#
!
!
+ *
2N
2M
,(
,
(
!
N
*1.#
!
*"(
E
7#
# !
&
&
+ *#
#
(
#
4P2NQ5
+ *
2
2M
,(
0
2
E
*1.#
(
N
7#
*" + *
&
-
&
#'
+
*"
#
2
2M
,(
3
&
$
E
N
&
N
& 46
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
.
" #$# #%
B
*1.
)
! #
@B
%
:37B/2
(
+
-!
%
(
(
!
+
)
)
%
@ *
) ! %
) 4,
5! %
4, 2
5! %
-
#
*"
#'
#'
B
)
!
"
/12
/12
%
#
*"
!
)
#'
*
#
(
6
)(
*
#
+
#'
+
B
)
#
!
/12
+
+
!
#'
!
&" :37B/2C
'
= > ( 377B
(
!
(
!
!
/12
!
#'
(
$C
@ * → :37B/2C
= > × :37B/2 × :37B/2 → :37B/2C
2
= > × = > × :37B/2 × :37B/2 × :37B/2 → :37B/2
,
,
& #&
="!(
(3
=
#&
@ *
: *"( &
@
" #
%
!
/12
<
%
)
) (
%
!
%
#
(
#(
,
:37B/2 /→ :37B/2C
= > × :37B/2 → :37B/2C
:37B/2 → 377B $C
( %
@
:37B/2 /→ = > C
$- @
:37B/2 → , : =$ BC
> @ ( > 6@
:37B/2 /→ = > C
#
:37B/2C
/
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
="!4 5 $7
@ *4 5C
4 5 $7
@ *4 5C
,
4 5 $7
@ *4 5 $ $- @
4 5 . /C
: *"4 5 $7
@ *4 5 $ $- @
4 5. C
&
@
4 5 $7
@ *4 5 $ $- @
4 5 . /C
%
@
4 5 $7
@ *4 5 $ $- @
4 5 . /C
> @ 4 5 $7
@ *4 5C
> 6@ 4 5 $7
@ *4 5C
"
"
"
"
"
"
"
"
( ' = > C( (
:37B/2C
@ *4
@ *5 .. :< C
@ *4,
4 ( ( 55 .. 0 B C
@ *4, 2
4 ( '( ( ( 55 .. 0 B
# #
> @ 4,
4 ( '( ( 55 ..
=
> @ 4,
2
4 ( '( (
> 6@ 4,
2
4 ( '( ( 55 ..
> 6@ 4,
2
4 ( '( (
$- @
$- @
$- @
4
4,
4,
: *"4,
&
="!4
="!4,
="!4,
2
4,
=
@ *4 5 $ 7$, '
=$7 > 6@ 4 5C
=
@ *4 5 $ 7$,
=$7 > 6@ 4 5C
( 55 ..
'
4 ( '( (
2
4 ( '( (
( 55 .. C
( 55 .. 'C
@ *5 ..
@ *C
4 ( ( 55 .. C
2
4 ( '( ( ( 55 .. C
#4
#4,
#4,
=
=
( 55 .. =
$ 7$,
4 5C
$ 7$,
4 5C
@ *5 ..
4 ( ( 55 ..
2
4 ( '( ( ( 55 .. /
4,
@
,
@ *4 5
=$7 > @
@ *4 5
=$7 > @
4 ( ( 55 .. C
@
%
C
@ *5 ..
@ *C
4 ( ( 55 .. C
2
4 ( '( ( ( 55 .. C
4,
2
4 ( '( (
4(
@ *5 .. ,
4(,
4'( ( 55 ..
= R' $ 7$,
!
4,
=$7
( 55 .. C
4(
@ *(
4'( =
@ *5C
4 ( 5( 55
/
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
=
3
3
3
!
!
!
4,
4'( ( =
4 ( 555C
4(, 2
4'( K( ( ( 55 ..
= R' $ 7$,
!
4, 2
4'( K( =
4 ( 5( ( 55
=$7 = RK $ 7$,
!
4, 2
4'( K( ( =
4 ( 5( 55
=$7
!
4, 2
4'( K( ( ( =
4 ( 555C
4(
@ *5 ..
@ *C
4 (,
4'( ( 55 ..
= .' $ 7$,
=
@ *S4 5 $ 7$,
@ *
=$7
!
4, /
4> 6@ 4 5(3
4> 6@ 4 5( 5( 55
=$7 = R' $ 7$,
!
4, /
4'(3
4 ( 5( 55
=$7
!
4, /
4'( (3
4 ( 555
4 (, 2
4'(K( ( ( 55 ..
= .' $ 7$,
=
@ *S4 5 $ 7$,
,
4K(
@ *(
@ *5
=$7
!
4, 2
4> 6@ 4 5(K(3
4> 6@ 4 5( 5( ( 55
=$7 = .K $ 7$,
=
@ *S4 5 $ 7$,
,
4'(
@ *(
@ *5
=$7
!
4, 2
4'(> @ 4 5( ( (3
4> @ 4 5( 555
=$7
= R' $ 7$,
!
4, 2
4'(K(3
4 ( 5( ( 55
=$7 = RK $ 7$,
!
4, 2
4'(K( (3
4 ( 5( 55
=$7
!
4, 2
4'(K( ( (3
4 ( 555C
4
4,
=
@ *5 ..
@ *C
4 ( ( 55 ..
4 5.
4 5 $ 7$,
,
4( ( 5
=$7 =
4 5G
4 5 $ 7$,
=$- @
4 5 . $ 7$,
, 2
4: *"4 5( (
="!4 5(
=$7
,
4 %
@
4 5(
,
4&
@
4 5(
//
#4 5( 5
="!4 5(
,
4 55(
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
,
4(
#4 5( 55
=$7
=$- @
, 2
=$7
,
,
,
!
4 5 . $ 7$,
4 ( : *"4 5( (
="!4 5(
4&
4( (
4 %
4,
=
2
4 ( '( ( ( 55 ..
45.
4 5.
, 2
4 ( '( ( ( 5
=$7 =
4 5.
45
=
45G
4 5
,
4( (,
=$7 4L3
L5
=$- @
4
,
,
@
4 5(
="!4 55(
@
4 5(
#4 55
,
4 5(
#4 555
4 5 $ 7$,
$ 7$,
$ 7$, 4L=
4'( ( 55
5.
4'(
2
) L5
$ 7$,
4 ( : *"4 5(
(
="!4 5(
#4 55( 5
=$7
,
2
4&
,
,
@
4 5( '(
4( (
="!4 55(
4
%
@
4 5(
,
4 5(
5
45.
4 5 $ 7$,
4 5G
4 5 $ 7$, 4L=
) L5
,
4: *"4 5(
,
4((
="!4 55(
,
4'(
#4 5( 55
=$7 4L3
L5
=$- @
4 5 . $ 7$,
,
4'(
, 2
4: *"4 5( (
="!4 5(
#4 5( 5(
5
=$7
, 2
4 %
@
4 5( '(
,
4 &
@
4 5(
="!4 5(
,
,
4 (
#4 5( 5(
5
=$7 =
4 5.
4 5 $ 7$,
=
45G
4 5 $ 7$, 4L=
) L5
,
4'( ,
4 ( ( 5( 5C
=$7 4L3
L5
=$- @
4 5 . $ 7$,
,
4( (
#4 55(
=$7 =
=
/2
4 55(
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
,
2
4 : *"4 5( '(
="!4 5(
#4 5( 55
=$7
,
2
4(
,
%
4&
@
@
="!4 5(
4 '(
,
4 5( (
4 5(
,
4 55(
#4 5( 55
$
.2 +'" '
& #%
*1.
+
!
B
)
%
+
TYPE
ARBOL23 = POINTER TO NODO;
NODO =
RECORD
NumValores: CARDINAL;
PrimerValor, SegundoValor: ELEMENTO;
Izquierdo, Medio, Derecho: ARBOL23;
END;
NumValores
+
BOOLEAN(
!
+
FALSE
TRUE
%
+9
B
!
TYPE
)
%
)
+
!
%
ARBOL23 = POINTER TO NODO;
NODO =
RECORD
CASE NumValores: CARDINAL OF
1:
Raiz: ELEMENTO;
Izquierdo, Derecho: ARBOL23;
2:
PrimerValor, SegundoValor: ELEMENTO;
Izquierdo, Medio, Derecho: ARBOL23;
END;
END;
9 NumValores
BOOLEAN
/E
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
/
8
B
!
#
9
3
'
+
%
!
%
%
+
-
-!
-
#
+
(
(
#
*
*
!
*
<
+ #
D
(
D
(
6
3
-!
!
%
/
5
6
/
*"( !
5
*
( 6
*
# '
#'
#' 4 ≤ ≤/ 5
(
& (& ( (&
#' (
•
&
!
•
&
!
•
&
/(
(
(
!
F
!
5
%
M
N
E
,(
,
/
/
2
M
E
N /
4
)(
3
$1
$ =@ /
/M
/2 /E /
2
2E
2 2/
2J 2
*
+
7
//
/12
%
$
!
3
-
)
/
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
/
+
#%
B
/12 B
+
# '
)
%
+
# '
/
(
+
) &
#*
/
/ F
&
( (
%
+
!
# '
(
F /(
+
!
(
(
+
/
F
9
#
*/
*" #
*"!
%
(%
(
(
+
@
+
3
*" )
'
(#
! 9
)
*"(
)
! !
/M
/M
EJ
5 +
'
%
/
/M
EJ
/
/M
%
NJ
EJ
NJ
EJ
/
,(
+
/ F
"
)
3
/M( EJ( NJ( /( JJ
/
NJ
+ +
!
!
EJ
/M
!
! (
JJ
@
# '
(
*
*"
)
#%
/M
'
JJ
&
)
*
E
/
NJ
!
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
2
α
2
β
2
2/
J
2
2
2N
E
E
χ
E
E/
E2
EE
δ
EM
EN
/
M
E
2
α
2
β
2
2/
2
2
,(
J
*6 +
2N
E
E
E2
E/
#%
'
EE
χ
E
E
EM
δ
EN
&/
/
M
*
E2
2
α
J
β
2
2/
,(
(
2
# '
!
*
2
2
2N
+
#%
!
E
γ
E
E
E/
'
EE
E
&
*
$(
4 !
+
EM
δ
EN
/
M
&
PEM( EN( /( MQ5
(
/J
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
+ "(
(
(
*"
E2
+
E2
+
/*
'
!
E2(
+ +
9
(
*"
(! + +
#%
B
)
)
9
# '
%
/12
(
(!
#
# '
(
%
( !
9
6
(
*
"!
)
,
%
+
"!
!
# ' !
(#
!
%-
"
#
5
(
-
B ! #
+
&
%
4
#
)
5
+
(
!
/ F
5
!
#
(
+
(
)
+
)
+
!
(
(
!
!
(
(
!
!
!
+
1
&
% (
%
#
!
)
%
%
*" ,
*"
/
*
!
!
)
-
#
/M
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
N
/
J
/
M
α
M
α
N
J
/
J
M
N
α
N
/
,(
**
'
'
!
# ' (
/ (
+
!
J
#%
%
'
& 6
*
(
4 5
"!
!
(
-
+
α
M
(
(
/
! #
/
/ F
(
+
E2
2
α
2
J
γ
β
EE
,(
EM
*.
ε
7
+
(
EE
/N
δ
2
EN
*
%
%
E
E
φ
χ
'
E2
# '
η
'
!
& /.
,
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
!
E (
P (
(
(#
+
PE ( E ( EM( ENQ( !
#
(
!
!
(
+
( 2( Q
# !
; ! + +
+
P 2( 2 ( EE( J Q
2
α
β
E
EM
;
(
*
%
%
N T
'
*
(
-
+
+
&
ε
&
φ
χ
'
η
#%
*"(
%
*
%
3F( !
'
*
(
& /.
T
B
%
%
)
%
%
(
H
δ
&
( 6
!
T B
+
3L
!
J
EN
$(
+
!
2
*/
,
"
0
*" ,
!
&
% "
+"0
+
(
+"
% "
+
*"
+
*"
EE
%
γ
E
,(
2
!
!
)
+
+ #
*(
( !
!
)
! ##
1
)
#
9
%
$(
9
%
)
)
)
D
+
+
+
)
+
!9
)
#
9
#
%
2
#'
! # %
!
&:
)
%
!
+
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
/1
%
#'
(
(
%
*"
(
#'
%
=
%
%
#
'
K
D
21
'
L
4 (=
.
%
4
!
(=
4 (=
4
2.
4 ( =
3 ! 8+ *555
/
.
4 ( =
3 ! 8+ *5555
.
4(=
/ /.
4
=
4
2(
)
3 ! 8+ *5555
4 ( 3 ! 8+ *5( 3 ! 8+ *555
4%( 3 ! 8+ *5( =
4
4
4
/
(
=
4
/ /(
=
4
4
4#( 3 ! 8+ *5(
4K(
3 ! 8+ *5(
4 ( 3 ! 8+ *5( 3 ! 8+ *55
4'( =
4
4 ( 3 ! 8+ *5( =
4
4 ( =
4
4D(
4 ( 3 ! 8+ *5( 3 ! 8+ *55( 3 ! 8+ *55( 3 ! 8+ *555
E1
>
# ' (
(=
4
/
=
/(
%
4 ( 3 ! 8+ *5
/.
/
4
! +
!
1/ !
!
)
%
! +
& '(
2
( #
*"
%
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
*
> = ( > = 7 > U =,7
> 7B :( > 7B ( > 7I ( > 7
1B
1
%
%
#' (
# ' $%
(
# '
%
1
# ' 3
'
(
4!
%
+
1B
(
!
%
!
!
+
%
5
# '
%
C
'
# '
%)(
1 B
,
6
-
/K5(
$%
( > =:: ( > =:7(
3
(
9 (
-
+
%
%
) !
%
(
+
1
2/
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
5
) !
1
(
+
%
!
!
2
6
+ %
!
(
( $
•
•
> 7 <B 1/ : ;
=
@
=
•
&
H # V
+ %
(,
V
# 3 '
%
# ( ;
,
W
>
% &
( <
;
# %,
(
(
1V
=
22
Created by Neevia docuPrinter trial version http://www.neevia.com
Created by Neevia docuPrinter trial version http://www.neevia.com
Descargar