Final Flashcards
Abstract Factory
A creational design pattern that creates an instance of several families of classes.
AnimalWorld Lab
Factory Method
A creational design pattern in which direct object construction is replaced with calls to special factory methods. The factory methods can now be overridden in a subclass and change the class of objects being created. This pattern creates an instance of several derived classes.
Document Lab (Resume and Report with different Pages)
Adapter
A structural design pattern that allows objects with incompatible interfaces to collaborate.
Square Peg Into Round Hole Lab
Composite
A structural design pattern that composes objects into tree structures to represent part-whole hierarchies. A composite lest clients treat individual object and compositions of objects uniformly.
Drawing Lab (Adding components to drawing)
Iterator
A behavioral design pattern that allows traversing elements of a collection without exposing its underlying representation (list, stack, tree, etc.).
Simple Collection Iterator Lab (Item<t>, Collection<t>, etc.)</t></t>
Observer
A behavioral design pattern that defines a subscription mechanism to notify multiple objects about any events that happen to the object they’re observing.
Stock Price Notification Lab
Row-Major Order Offset
offset = row * number of columns + column
E.g. row = 1, column = 1
offset = 1 * 3 + 1 = 3 + 1 = 4
Column-Major Order Offset
offset = column * number of rows + row
E.g. row = 1, column = 1
offset = 1 * 2 + 1 = 2 + 1 = 3
Graph Characteristics
- Path - Can have unidirectional or bidirectional edges between nodes
- Loops - can have loops, circuits, and self-loops
- Root Node - No concept of a root node
- Parent-Child - No parent-child relationship
- Complexity - Loops increase the complexity
- Traversal - Depth First Search (DFS) and Breadth First Search (BFS)
- Graph Category - Cyclic or acyclic
- Types - Directed and undirected
- Applications - Coloring of maps, PERT charts, graph coloring, job scheduling, etc.
- Number of Edges - Depends on the graph
- Model - Network
Tree Characteristics
- Path - A special form of graph (i.e., minimally connected graph), having only one edge between any two vertices
- Loops - No loops, no circuits, and no self-loops
- Root Node - Exactly one root node and each child has only one parent
- Parent-Child - Parent-child relationship
- Complexity - Less complex
- Traversal - Pre-order, in-order, and post-order
- Graph Category - Directed Acyclic Graph (DAG)
- Types - Binary, binary search, AVL, heaps, etc.
- Applications - Sorting and searching applications
- Number of Edges - N-1
- Model - Hierarchical