CS 401 Ch.1-4.7

¡Supera tus tareas y exámenes ahora con Quizwiz!

Heap Delete(h, i)

Similar to insert the heap will have to swap and traverse the tree in order to make sure nothing violates the heap property. Thus taking O(log n) time.

Topological Ordering Problem

Start Node and Final Node stay the same. The nodes in between change order. Could branch as a tree. or use n!/(some number of blanks)

Minimum Spanning Tree

Dictates the shortest aggregate path from one node to every node. A spanning tree connecting all nodes together with the minimum aggregate value of its edges. A MST can always be a minimum bottleneck spanning tree.

Dijkstra's Algorithm vs Prim′s Algorithm

Dijkstra's algorithm finds the shortest path, but Prim's algorithm finds the MST. Dijkstra's algorithm can work on both directed and undirected graphs, but Prim's algorithm only works on undirected graphs. Prim's algorithm can handle negative edge weights, but Dijkstra's algorithm may fail to accurately compute distances if at least one negative edge weight exists

Trees

An undirected graph is a tree if it is connected and does not contain a cycle. Rooted Trees is where a Tree has a root "r" which the tree orients itself away from.

Connectivity

An undirected graph is connected if for every pair of nodes u and v, there is a path between u and v.

BFS vs DFS

BFS is suitable for shortest path in a unweighted graph. DFS is made suitable when there are solutions away from the source.

Optimization Problems

Problems that require a max/min result

Independent Set Problem

The Independent Set Problem is, then, the following: Given G, find an independent set that is as large as possible.

Directed Acyclic Graphs

A DAG is a directed graph that contains no directed cycles.

Cut

A cut is a partition of the nodes into two nonempty subsets S and V - S. The cutset of a cut S is the set of edges with exactly one endpoint in S.

Cycle

A cycle is a path were one node has more than one edge returning to it. A cycle is simple if all nodes are distinct.

Undirected Graph

A graph in which the edges have no direction.

Weighted graph

A graph in which there is a number associated with each edge [its weight]. Dijkstra's and Prim's Algorithms are used commonly in these type of graphs.

Graph

A graph is a collection of nodes that are connected by edges. The notation is G (graph), V (nodes), and E (edges). Where G = (V, E).

Strong Connectivity

A graph is strongly connected if every pair of nodes is mutually reachable. Which mutually reachable means where there is a path from u to v and also a path from v to u.

Bipartite Graphs

A graph that can be split into two groups L and R, where every vertex v ∈ V belongs to one group or the other but not both. Every edge in the graph has one endpoint in one group and the other in the other group. If a graph G is bipartite, it cannot contain an odd-length cycle.

Unweighted Graph

A graph whose edges do not have any sort of value. DFS and BFS algorithms are used commonly in these type of graphs.

Heap

A heap is a semi ordered tree based data structure where: Either each parents keys is greater than its children (Max heap greatest element on top). Or could be each parents keys is less than its children (Min heap smallest element on top). Could have a max number of children which is called a binary heap. (2 Children per parent). Top to bottom is guarantee but not left to right.

Greedy Method

A method to solve an optimization problem. The method emphasizes the idea that a problem should be solved in stages and in each stage we will consider an input from a given problem. If the input is feasible then we will include it in the solution. By getting all of these inputs we will get an optimal solution.

Minimum-Bottleneck Spanning Tree

A minimum spanning tree that contains the smallest bottleneck edge. Cannot always be a minimum spanning tree.

Path

A path in an undirected graph G = (V, E) is a sequence of nodes with the property that each consecutive pair u and w is joined by a different edge. A path is simple if all nodes are distinct.

Interval Positioning Problem

A problem that occurs when we have many identical resources available and we wish to schedule all requests. Ex. Classrooms = Resources and Classes = Requests

Optimal Solution

A solution that is already feasible and that gives me the minimum/maximum result to a problem. Their can only be one optimal solution for a problem.

Strong Components

A strong component is a maximal subset of mutually reachable nodes.

Topological Ordering

A topological order of a directed graph G = (V, E) is an ordering of its nodes as v1, v2, ..., vn so that for every edge (vi , vj ) we have i < j.

Two Types of Graph Representation

Adjacency List and Adjacency Matrix

Dijkstra's algorithm

An algorithm for finding the shortest paths between nodes in a graph. Starts at a specific starting node. It will be given a value of 0 and the rest of the nodes will be given a value of infinity. The target node will be given a value of infinity, but will be marked as the target node. Each Node along with their starting value (infinity) will be stored in a Priority Queue. The priority queue is a queue that will sort its values to have the smallest value at the front of the queue. It will sort itself if a new node is added or if a new value is given to a node in the queue. In addition as each node is visited it will need to keep track of the previous node it is coming from and the weight between them. Each value in the queue will be checked beginning with the starting node. As a node in the queue is visited it will be rearranged in the queue. Each node will have a weight plus the weight of the past node. Once the target is reached it will back track to the starting node.

Cashier′s Algorithm

At each iteration, add coin of the largest value that does not take us past the amount to be paid.

Polynomial Running Time

Desirable scaling property. When the input size doubles the algorithm should slow down by at most some multiplicative constant factor of C. If this requirement is met then the algorithm is poly-time and it is efficient.

Interval Scheduling Approaches

Earliest start time, Earliest finish time, Shortest Interval

Independent Set

Given a graph G = (V, E), we say a set of nodes is independent if no two nodes in the set are joined by an edge.

Greedy Algorithms

Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit. By some metric, always choose the "most productive" option. Build bit-by-bit into a larger solution.

Heap Data Storage

In a heap the Index 0 is left open and the root is stored in index 1. To get a value the calculations are as follows: Parent -> floor(Index/2) Children-> (2*Index) + 1

Heap Insert(h, v)

Inserts an item v into the heap. The value that is inserted will be placed at the bottom of the tree. If it violates the heap property the heap will either heapify up/down depending on the type of heap. This will take O(log n) time because swapping is O(1) but traversing the tree takes O(log n).

Priority Queue

Like a queue but always has the max/min value at the front of the list. Uses a Heap data structure to sort the values that are inserted. Making the front of the list the root node.

Run Time

O(n), O(n), O(log n), O(n log n), O(n^k), O(2^n^k)

Prim′s Algorithm

Pick an arbitrary node to start and add to the visited list. Examine every edge available from the starting node and find the smallest weight. Visit that node and add it to the visited list. Then visit the smallest weight of a node from any of the nodes in the visited list. Keep doing so until all nodes have been visited. When all nodes are visited the algorithm should produce a minimum spanning tree.

StartHeap(n)

Returns an empty heap this is set up to store at most (n) elements. It also initializes an array to store all the n elements in the heap. Because of this the run time is O(n) because we will sort n values into the array.

Gale-Shapley Algorithm

Solves in O(n^2) time

Breadth First Search

Starts at a arbitrary node and travels to each adjacent node. However it just travels a distance of one and the nodes in that distance are bunched together in one layer (L). The BFS travels by layers and uses a Queue in order to do so. The Queue is used to pick whose next will be explored in the next layer. Will also create a different graph to the original depending if it the graph has cycles or not. (For traversing or searching tree or graph data structures) Actually runs in O(m + n) time

Depth First Search

Starts at an arbitrary node and travels to an adjacent node. From that node it keeps traveling consecutive nodes until it reaches a dead end. Then it will back track and go in a different path. It will eventually traverse the whole graph but will visit the nodes in a different order than a BFS. The DFS utilizes a stack to store the values that will be explored once its current path reaches a dead end. (For traversing or searching tree or graph data structures)

Gale-Shapley Problem

The problem of finding a stable matching between two equally sized sets of elements given an ordering of preferences for each element. There can be stable and unstable pairs who depending on the problem have certain requirements. However certain problems output matches that can never be stable.

Directed Graph

This is a graph where an edge has a direction associated with it, for example, a plane flight that takes off in one location and arrives in another. The return flight would be considered a separate edge.

Bottleneck Edge

We define the bottleneck edge of G to be the edge of G with the greatest cost.


Conjuntos de estudio relacionados

Ch. 11 Fiscal Policy Questions, Ch. 11 Fiscal Policy Vocab, Ch. 11 Fiscal Policy Videos

View Set

Macroeconomics, Carol Hogan, University of Michigan - Deaborn, Review Questions

View Set

Anatomy & Physiology 1 - Chapter 1

View Set

Business Ethics Chapter 11 Test Questions

View Set

Sociology Exam 2 (Chapters 3 & 4)

View Set

PSET 310 Safety Device Testing Frequency

View Set

Anatomy and Physiology II Ch. 26 - Urinary System (Part 2)

View Set

Tax Accounting - Chapter 12 Learn Smart

View Set