[Solved] CS317 Homework 2

$25

File Name: CS317_Homework_2.zip
File Size: 150.72 KB

SKU: [Solved] CS317 Homework 2 Category: Tag:
5/5 - (1 vote)
  1. Draw a recursion tree (as shown in the notes) to sort the following array using MergeSort (5 points)
3 17 43 2 67 35 7 25 40
  1. Sort the following array visually (as shown in the notes) using

QuickSort (indicate the position of P, L , R in each step) (5 points)

43 21 90 8 44 35 6 2 13
  1. State 5 real world applications of Graph Theory. (5 points)
  1. State the difference between an undirected and a directed graph. (4 points)
  1. Identify edges and vertices in the following graphs. (4 points)
  1. Represent the following graphs using Adjacency List and

Adjacency Matrix. (8 points)

  1. Apply the DFS traversal algorithm on the following graph and indicate when each vertex was discovered and processed. Also state the order in which each vertex was processed. Show your stack and the traversal order. (5 points)
  1. Apply the BFS traversal algorithm on the following graph and indicate when each vertex was discovered. Also state the order in which each vertex was processed. Show your queue and the traversal order. (5 points)
  1. What is the efficiency for representing a graph using an adjacency matrix and adjacency list? (2 points)
  1. Explain the Greedy technique in plain English. Give one example where Greedy technique works and one where it does not work.

State the generic Greedy Algorithm and the Greedy-Choice Property. (5 points)

  1. What is a spanning tree? Find all spanning trees of the following graph. (4 points)
  1. What is a minimum spanning tree? Give an example. (3 points)
  1. Find a minimum spanning tree in the following graph using Prims and Kruskals Algorithm. Show all the steps i.e. how a vertex or edge is added in the set to form/grow a minimum spanning tree. (10+10 points)
  1. Consider the following graph. List the shortest path between A and rest of the vertices using Dijkstras algorithm. Show the shortest path graph and shortest path matrix. Build the shortest path graph step by step. (10 points)
  1. Encode/compress the following string using Huffman encoding technique. Show each step with min-priority queue values, and final binary Huffman tree. Give the encoding of each letter. Calculate the compression ratio over 8-bit binary representation of the string. (10 points)

TENNESSEE

  1. Sort the following elements (in place) in an ascending/increasing order using HeapSort. Show step by step execution of the HeapSort algorithm. (10 points)

9,4,1,6,3,8,2,10

  1. Implement QuickSort and MergeSort to sort the given input (list of numbers) accepted through the command line. Use the debugging techniques shown in the class as an aid to design your programs. Write down the steps that you took to debug your program in your favorite IDE (include screenshots). You can use any modern programming language for this assignment. You can take input from user or hard code it in your program. Input size should at least 5. (10+10 points)

Submit: Source code, debug instructions and debug screenshots

  1. Implement DFS and BFS graph traversal algorithms to traverse a given graph in the form of an adjacency matrix or an adjacency list. You can decide whether your graph will be directed or undirected. Take an input from users through command line. Print the time (as in counter we use in class like 0/0) when each vertex of the graph was discovered/processed. Support taking input up to 10 nodes/vertices. You can use any modern programming language for this assignment. (10 + 10 points) Submit: Source code and output

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS317 Homework 2[Solved] CS317 Homework 2
$25