base de datos
datos básicas
Secuencias
Xavier Sáez Pous
PID_00146766
Material docente de la UOC
© FUOC • PID_00146766
Primera edición: septiembre 2010
© Xavier Sáez Pous
Todos los derechos reservados
© de esta edición, FUOC, 2010
Av. Tibidabo, 39-43, 08035 Barcelona
Diseño: Manel Andreu
Realización editorial: Eureca Media, SL
ISBN: 978-84-693-4239-8
Depósito legal:B-33.175-2010
Ninguna parte de esta publicación, incluido el diseño general y de la cubierta, puede ser copiada,
reproducida, almacenada o transmitido de ninguna manera ni por ningún medio, tanto eléctrico
como químico, mecánico, óptico, de grabación, de fotocopia, o por otros métodos, sin la autorización previa
por escrito de los titulares del copyright.de los titulares del copyright.
Estructurasde datos básicas
c FUOC • PID_00146766
Estructuras de datos básicas
Índice
Introducción . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
Objetivos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
1.
Pilas . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
1.1.
Representación . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
1.2.
Operaciones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
1.3.
Implementación .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12
1.4.
Ejemplo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
Colas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
2.1.
Representación. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
2.2.
Operaciones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
2.3.
Implementación . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
2.4.
Ejemplo . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
Listas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
3.1.
Representación . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
3.2.
Operaciones . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
2.
3.
3.3.
4.
25
Implementación secuencial . . . . . . . . . . . . . . . . . . . . . . . . . .
25
3.3.2.
3.4.
Implementación . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3.1.
Implementación encadenada . . . . . . . . . . . . .. . . . . . . . . . . .
28
Ejemplo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33
Punteros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
4.1.
Problemas de los vectores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. .
35
4.2.
La alternativa: punteros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
4.3.
Implementación . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
4.3.1.
Pila . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
4.3.2.
Cola...
Regístrate para leer el documento completo.