DSA 3: Algorithms and Algorithm Strategies

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Greedy

Identify the algorithm strategy employed by Dijkstra's shortest path algorithm.

Dynamic Programming

Identify the algorithm strategy employed by a program that computes Fibonacci Numbers recursively, but also stores solutions of subproblems to reduce runtime complexity.

Brute Force

Identify the algorithm strategy employed by a program that searches a sorted array by comparing the target value to each value in the array, until the target value is found or until the all values have been compared.

divide and conquer

Identify the algorithm strategy employed by an algorithm that sorts an array (or list), by first dividing the n-element sequence into two n/2 element subsequences. Next, the algorithm recursively sorts the subsequences by dividing each subsequence, until each sequence has only one element. Finally, the algorithm combines the two sorted subsequences.

Brute Force

Identify the algorithm strategy employed by the Selection Sort algorithm.

Kruskal's Minimum Spanning Tree algorithm

This algorithm is a greedy algorithm that finds an edge of the least possible weight that connects any two trees in the forest. It finds a minimum spanning tree for a connected weighted graph by adding increasing cost edges at each step. This means that it finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized. This algorithm also works to find the minimum spanning forest for a disconnected graph.

linear search

This algorithm scans through a sequence in order, looking for a item that meets target criteria.

Selection Sort

This algorithm sorts an array (or list), starting at the lowest index, by repeatedly finding the minimum element from the unsorted part and putting it at the beginning of the unsorted part.

greedy

This algorithm strategy always makes the choice that looks best at the moment. It makes a locally optimal choice in the hope that this choice will lead to a globally optimal solution, but it does not always yield a globally optimal solution.

Dynamic Programming

This algorithm strategy recursively breaks down a problem into two or more sub-problems of the same or related type, until these become simple enough to be solved directly. The solutions to the sub-problems are stored so that we do not have to re-compute them when needed later. The solutions to the sub-problems are combined to give a solution to the original problem.

divide and conquer

This algorithm strategy recursively breaks down a problem into two or more sub-problems of the same or related type, until these become simple enough to be solved directly. The solutions to the sub-problems are then combined to give a solution to the original problem.

DFS

This algorithm traverses or searches a tree or graph data structure. It starts at the tree root, or some arbitrary node of a graph, and explores "deeper" in the graph whenever possible. Once all of these edges have been explored, the search "backtracks" to explore edges leaving the vertex from which this vertex was discovered. This process continues until all the vertices that are reachable from the original source vertex have been discovered. If any undiscovered vertices remain, the search selects one of them as a new source, and it repeats the search from that source. The algorithm repeats this entire process until it has discovered every vertex.

Quicksort

This divide and conquer algorithm sorts an array (or list) with the following process. First, divide (or partition) the array into two sub-arrays (A[p..q-1] and A[q+1..r], such that each element in the sub-array A[p..q-1] is less than or equal to A[q], and each element in A[q+1.. r] is greater than or equal to A[q]. Next, apply this algorithm recursively to the sub arrays A[p..q-1], and A[q+1..r].

bubble sort

This is a brute force algorithm that repeatedly swaps adjacent elements of an array or list that are out of order, until the list is ordered.


Kaugnay na mga set ng pag-aaral

Chapters 66, 69, 70 - Hinkle & Cheever: Brunner & Suddarth's and Chapter 49 - Maternal & Child Health Nursing

View Set

Chapter 29 Gastrointestinal Disorders and Therapeutic Management

View Set

Chapter 6: An Introduction to Viruses, Viroids, and Prions

View Set

Point of View by E Reading Worksheets

View Set