Chapter 8--abstract Data Types & Subprograms Flashcards
Data structure?
The implementation of a composite data field in an abstract data type
Abstract data type?
A container whose properties are specified independently of any particular implementation
Discuss stacks.
LIFO. Adding an item is called a “push”. Removal is called a “pop”.
We do need operations that check if a stack is empty, because popping an empty stack would cause an error.
Give the multiple names for adding and removing queue items.
Enqueue, enque, enq, enter, insert.
Dequeue, deque, deq, delete, remove
List the 3 properties of lists.
The items are homogeneous, linear, and lists have varying lengths
Name some common list operations.
Insert, delete, check if an item is there (IsThere), and get number of total list items (GetLength). Also viewing items in sequence (Reset, GetNext, MoreItems).
Linked structure?
An implementation of a container where the items are stored together with information on where the next item is.
A list can be thought of as a linked structure. Linked structures contain nodes, which contain 2 things–the user’s data and info on where to find the next node.
What does the end of a list consist of?
A link that contains “null”, which is indicated by a /
What is a binary tree node that has no children called?
A leaf node
Binary search tree?
The value in any node is greater than any value in its left sub tree, and less than any value in its right subtree
“Parameter list”?
A list of identifiers or values with which the Subprogram is to work. It appears in parenthesis beside the Subprogram name.
It is a mechanism for communicating between two parts of a Subprogram.
Parameters? Give alternate name as well.
A.K.A. formal parameters. They are identifiers that appear in parentheses beside the Subprogram name.
Arguments?
The identifiers listed in parenthesis on the Subprogram call; a.k.a. actual parameters.
What is the most common way that arguments are substituted for parameters on a Subprogram call?
Position
Define/name the two types of called parameters.
Value parameters/arguments cannot be changed by the Subprogram, b/c the Subprogram only is given their value.
Reference parameters/arguments CAN be changed by the Subprogram, because the Subprogram is given their address.