Samenvatting Datastructuren
Timo Kats, Informatica en Economie
1
,Indeling:
1. Basic Datastructures
2. Tree Traversal
3. Binary Search Trees
4. Balancing Binairy trees
5. Priority Queues
6. B-Trees
7. Graphs
8. Hash Tables
9. Data Compression
10. Pattern Matching
(ADT’s zijn rood omdat ze letterlijk teruggevraagd worden in het TT, de andere onderwerpen moet je
vooral kunnen toepassen)
2
,1: Basic Datastructures:
Wat is een ADT (Abstract Data Structure)?
Een abstracte datastructuur is een beschrijving van een datastructuur, met
de specificatie van wat er opgeslagen wordt (de data en hun structuur) en
welke operaties op de data zijn toegestaan.
Stack:
• LIFO, data wordt bovenaan de ‘Stack’ toegevoegd.
• ADT Stack:
▪ INITIALIZE: construct an empty sequence ().
▪ ISEMPTY: check whether there the stack is empty, i.e., contains
no elements).
▪ SIZE: return the number of elements, the length of the
sequence(x1,...,xn).
▪ TOP: returns the top xn of the list (x1,...,xn). Undefined on the
empty sequence.
▪ PUSH(x): add the given element x to the top of the sequence
(x1,...,xn), so afterwards the sequence is (x1,...,xn,x).
▪ POP: removes the topmost xn element of the sequence
(x1,...,xn), so afterwards the sequence is (x1,...,xn−1).
Undefined on the empty sequence.
3
, Queue:
• FIFO, data wordt opgeslagen in dezelfde volgorde als het wordt
toegevoegd.
• ADT Queue:
▪ INITIALIZE: construct an empty sequence ().
▪ ISEMPTY: check whether there the queue is empty, i.e., contains
no elements).
▪ SIZE: return the number of elements, the length of the
sequence(x1,...,xn).
▪ FRONT: returns the first element x1 of the sequence (x1,...,xn).
Undefined on the empty sequence.
▪ ENQUEUE(x): add the given element x to the end/back of the
sequence (x1,...,xn), so afterwards the sequence is (x1,...,xn,x).
▪ DEQUEUE: removes the first element of the sequence (x1,...,xn), so
afterwards the sequence is (x2,...,xn). Undefined on the empty
sequence.
List:
• Slaat lineaire sequenties van elementen op.
• ADT List:
▪ INITIALIZE: construct an empty List().
▪ EMPTY TEST: check whether there the stack is empty, i.e., contains
no elements).
▪ RETRIEVAL: Get an element from the List
▪ CHANGE and DELETION of the value stored at a certain position
▪ ADDITION(x) of a new value "in between" two existing values, as
well as before the first or after the last position.
4
Timo Kats, Informatica en Economie
1
,Indeling:
1. Basic Datastructures
2. Tree Traversal
3. Binary Search Trees
4. Balancing Binairy trees
5. Priority Queues
6. B-Trees
7. Graphs
8. Hash Tables
9. Data Compression
10. Pattern Matching
(ADT’s zijn rood omdat ze letterlijk teruggevraagd worden in het TT, de andere onderwerpen moet je
vooral kunnen toepassen)
2
,1: Basic Datastructures:
Wat is een ADT (Abstract Data Structure)?
Een abstracte datastructuur is een beschrijving van een datastructuur, met
de specificatie van wat er opgeslagen wordt (de data en hun structuur) en
welke operaties op de data zijn toegestaan.
Stack:
• LIFO, data wordt bovenaan de ‘Stack’ toegevoegd.
• ADT Stack:
▪ INITIALIZE: construct an empty sequence ().
▪ ISEMPTY: check whether there the stack is empty, i.e., contains
no elements).
▪ SIZE: return the number of elements, the length of the
sequence(x1,...,xn).
▪ TOP: returns the top xn of the list (x1,...,xn). Undefined on the
empty sequence.
▪ PUSH(x): add the given element x to the top of the sequence
(x1,...,xn), so afterwards the sequence is (x1,...,xn,x).
▪ POP: removes the topmost xn element of the sequence
(x1,...,xn), so afterwards the sequence is (x1,...,xn−1).
Undefined on the empty sequence.
3
, Queue:
• FIFO, data wordt opgeslagen in dezelfde volgorde als het wordt
toegevoegd.
• ADT Queue:
▪ INITIALIZE: construct an empty sequence ().
▪ ISEMPTY: check whether there the queue is empty, i.e., contains
no elements).
▪ SIZE: return the number of elements, the length of the
sequence(x1,...,xn).
▪ FRONT: returns the first element x1 of the sequence (x1,...,xn).
Undefined on the empty sequence.
▪ ENQUEUE(x): add the given element x to the end/back of the
sequence (x1,...,xn), so afterwards the sequence is (x1,...,xn,x).
▪ DEQUEUE: removes the first element of the sequence (x1,...,xn), so
afterwards the sequence is (x2,...,xn). Undefined on the empty
sequence.
List:
• Slaat lineaire sequenties van elementen op.
• ADT List:
▪ INITIALIZE: construct an empty List().
▪ EMPTY TEST: check whether there the stack is empty, i.e., contains
no elements).
▪ RETRIEVAL: Get an element from the List
▪ CHANGE and DELETION of the value stored at a certain position
▪ ADDITION(x) of a new value "in between" two existing values, as
well as before the first or after the last position.
4