Chapter 8: Data Abstraction Flashcards
1
Q
Lists
A
A list is a collection of data whose entries are arranged sequentially.
The beginning of a list is called head and the end is called tail
2
Q
Stacks
A
- A stack is a list which entries are removed and inserted only at the head
- The head of the stack if called top and the tail is called bottom
- Inserting an entry to a stack is called pushing, and removing an entry is called popping.
- Stack is a LIFO (Last-in-first-out) structure
3
Q
Queues
A
- A queue is a list in which entries are removed only at the head and inserted only at the tail
- Inserting an entry to a queue is called enqueuing, and removing an entry is called dequeuing.
- Queue is a FIFO (First in first out)
4
Q
Tree
A
- A tree is a collection of data whose entries have an hierarchical organization
- Each position in a tree is called a node, the single node at the top is called root node, and the nodes at the bottom are called leaf nodes.
- A node’s immediate descendants are called children and its immediate ascendant is called its parent.
- A tree where each node has at most two children is called a binary tree.
5
Q
Static versus dynamic data structures
A
- A static data structure can’t change its shape or size over time, but the content can be changed
- A dynamic structure can, on the other hand change its shape and size over time.
- Pointer is a location in memory that contains an address to some other location in memory
A pointer is used to store and manage the addresses of dynamically allocated blocks of memory.
6
Q
User-defined data types
A
- Those data types which are defined by the user are called user-defined data types
7
Q
Abstract data types
A
- Data type that can include both data and functions (operations on the data)