Unit 7 - Data Structures Flashcards
What is an Abstract Data Type?
An ADT (Abstract Data Type) is a logical description of how we view the data type and possible operations.
What is encapsulation?
Encapsulation is a form of information hiding, a form of abstraction which ADTs use.
Give the process of a queue.
Add an item to the rear
Remove an item from the front
Check if the queue is full
Check if the queue is empty
What is a hash function?
A hash function is a function used to obtain the unique address of a record of a large data set.
What is a collision?
A collision is where the algorithm generates the same address for different keys.
Give one problem with hash tables.
One notable issue with hash tables is the increase in collisions as the table fills up.
Give the names of hashing algorithms.
- Mid square method
- Folding method
What is the mid-square method?
Mid square method is where a number is squared, then a few digits are extracted and the mod function is performed to get an address.
What is the folding method?
The folding method is where the a number is divided into pieces of equal sizes, and these segments of the number are added together. The result will be mod by the table size, and the remainder obtained is the address.
What is a graph?
A graph is an abstract data structure which represents complex relationships.
Describe an undirected graph.
An undirected graph is a graph consisting of nodes being joined together by edges (links), each with a weight (number). But there are no arrows on the edges, hence there is no direction.
Describe a directed graph.
A directed graph does show the direction of edges, so links between nodes can be identified. There are no weights on the edges, however.
Define a graph.
A graph is a set of vertices and nodes connected by edges. The edges may sometimes have a weight value on them, representing the magnitude of a value.
What are the two ways to represent a graph?
- Adjacency matrix
- Adjacency list
Define an adjacency matrix.
The adjacency matrix is a square matrix grid representing the nodes and their connections to other nodes, in both weighted and unweighted graphs.