Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Conjuntos dinámicos
Operaciones de consulta
SEARCH
MIN
MAX
función malloc();
Estructuras de datos
Pilas (STACK)
Inserción (apilar):
PUSH(S, k)
S.top ++
S.data[S.top] = k
Desapilar:
POP(S)
IF IS_EMPTY(S):return error
temp = S.data[S.top]
S.top = S.top - 1
Return t
Colas (QUEUE)
Inserción (encolar):
ENQUEUE(Q, k)
IF IS_FULL(Q)
return error
Q.tail++
Q.data[Q.tail] = k
Q.size++
Desencolar:
DEQUEUE(Q, K)
IF IS_EMPTY(Q)
return error
t = Q.data[Q.head]
Q.head++
Q.size--
return t
IS_FULL(Q)
IS_EMPTY(Q)
return Q.size == 0
Notaciones de operadores
Notación prefix
Listas (LIST)
Colección de nodos donde cada nodo contiene una liga al siguiente nodo.
search(L, K):
t = L.head
t = t.next
return t
insert(L, x):
x.next = L.head
L.head = x
append(L, x):
t=L.head
if(L.head == NULL)
L.head = x
return
while(t.next != NULL)
t = t.next
t.next = x
delete(L, k):
if(L.head.k == k)
L.head = L.head.next
return
t = L.head
t= t.next
if(t.next == NULL)
return error
t.next = t.next.next
Colección de nodos donde cada nodo contiene una liga al siguiente nodo y al anterior.
search(L, k):
t = L.head
t= t.next
return t
insert(L, k):
x.next = L.head
if(L.head != NULL)
L.head.prev = x
L.head = x
append(L, x):
if(L.head == NULL)
L.head = x
return
t = L.head
while(t.next != NULL)
t = t.next
t.next = x
delete(L, k):
t = search(L, k)
if (t == NULL)
return error
if (t.prev != NULL)
t.prev.next = t.next
if (t.next != NULL)
t.next.prev = t.prev
if (t == L.head)
L.head = L.head.next
Colección de nodos donde cada nodo contiene una liga al siguiente nodo, y el último
al primero.
search(L, K):
t = L.head
t = t.next
if(t==L.head)
return NULL
return t
insert(L, x):
if(L.head ==NULL)
L.head = x
x.next = x
return
x.next = L.head
t= L.head
while(t.next!=L.head)
t= t.next
t.next = x
L.head = x
append(L, x):
if(L.head ==NULL)
L.head = x
x.next = x
return
x.next = L.head
t= L.head
while(t.next!=L.head)
t= t.next
t.next = x
delete(L, k):
if(L.head = NULL)
return error
if(L.head.k == k)
L.head = NULL
t = L.head
while(t.next.k != k)
t=t.next
if(t==L.head)
return error
if(t.next == L.head)
L.head = L.next.next
t.next = t.next.next
search(L, K):
t = L.head
t = t.next
if(t==L.head)
return NULL
return t
insert(L, x):
If(L.head==NULL)
L.head = x
L.hed.prev = x
L.head.next
x.next = L.head
x.prev = L.head.prev
L.head.prev.next = x
L.head.prev = x
L.head = x
append(L, x):
if(L.head ==NULL)
L.head = x
L.head.prev = x
L.head.next
x.next = L.head
x.prev = L.head.prev
L.head.prev.next = x
L.head.prev = x
delete(L, k):
t = search(L, k)
if(t==NULL)
return error
if(t==t.next)
L.head=NULL
return
t.prev.next = t.prev
t.next.prev = t.prev
if(t==L.head)
L.head = L.head.next
C Python
Se puede usar un tipo de dato como otro Las estructuras de control se delimitan con
distinto [por ejemplo char++ (char a int) o sangrado (indentation)
while(char) (char a bool)] Las estrucuras de
control se delimitan con ^{}
Análisis de algoritmos
Recurrencias: