Design and implement a program based on a greedy algorithm

Assignment Help Data Structure & Algorithms
Reference no: EM131220887

Data Structures and Algorithms Assignment

Objectives

Design and implement a program based on a greedy algorithm to solve the Minimal Spanning Tree (MST) problem;

Choose and implement appropriate data structures for the algorithm;

Analyse the efficiency of different implementations of the algorithm in comparison with the brute force algorithm.

Task -

You should write a single program which implements Prim's algorithm with different data structures, as well as the brute force search algorithm, to find the MST of an undirected, connected, weighted graph.

Program -

Your program should read a symmetric matrix from a text file that describes weighted edges of an undirected, connected graph and find the MST that is saved in an output file as a sequence of edges of the MST. The program also displays the numbers of vertices and edges in the graph and the time spent to find its MST for each data structure used in Prim's and the brute force search algorithms, which can be saved in another output file as well for your later analysis.

Your program should only measure the time spent by the algorithm with its data structure to find the MST so that it is a proper design to use one method/function to implement an algorithm and its associated data structure. For an algorithm that operates on a weight matrix, it takes the weight matrix stored in a two-dimensional array as its parameter; for an algorithm that operates on adjacency lists, it takes adjacency lists you created from the weight matrix. You may create your own list data structures based on arrays. No STL or Java Collection or other collection framework can be used. In the part of the algorithm implementation, you should not use any library functions including maximal or minimal functions but create your own functions to operate on arrays.

Your program should be readable and well commented.

In addition, you needs to create a small program or script to generate the weight matrix for a graph of various vertices and edges, saved to a text file. When you create graphs, you need consider the density and connectivity of graphs. You may use a program/script by other people, with reference to the source, to generate these matrices.

Data Structures and Algorithms

Brute force search algorithm

The algorithm operates on a two-dimensional array that represents the weight matrix.

Prim's algorithm

The algorithm operates on one of the following data structures:

1. two-dimensional array that represents the weight matrix and unordered arrays;

2. adjacency lists and heaps.

Requirements -

1. Program

Implement the brute force search algorithm and Prim's algorithm operating on two data structures: matrix and heaps.

2. Report

a. Cover page

b. Introduction (around 200 words)

Describe application scenarios where the MST is applied and identify one application as the background and purpose of your experiments. You should interpret well the meanings of the vertices and edge weights, and why it is an MST problem in your identified application. Cite at least three references.                                       

c. Methods (around 300 words)

Describe algorithms you used in your experiments and data you used to produce the results.                                                                                                             

d. Result analysis (no more than 600 words)

Analyse the time complexity of your algorithms and discuss your results. You need to produce results with substantial differences in time spent for each algorithm and data structure. You should use at least one plot to present the results in terms of time spent and graph sizes.                                                                                               

e. Conclusion (around 50 words)

Summarise your findings and interpretations.

f. References

Other requirements

You must cite references from academic sources. Internet URLs including Wiki pages are not generally acceptable except they are used for links to resources.

All your programs including scripts will have the following header:

Your programs can be compiled and executed with bash scripts called a3compile and a3run, respectively, on Ubuntu setup in the lab.

The script a3run should be configured to run for a small graph that can finish within a fraction of a second.

The script should be configurable to run for a graph of any size.

The script can execute a program/script to generate the matrix before execute your MST program.

Failure to compile and run your program to produce results from your scripts will receive 0 mark.

Write a text ?le named readme to explain how your matrix is created, special consideration of your program compilation and execution, or any information related to your program that is necessary to configure and run your program to produce the results in your report. All your results reported in the report must be possibly produced by your submitted programs with easy configuration described in the readme file.

Report, named report.pdf, is created in the PDF format.

Failure to meet any requirements above may result in loss of marks.

Attachment:- Assignment.rar

Reference no: EM131220887

Questions Cloud

Find the exact percentage : If a person tests positive for thedisease, what is the chance that they have thedisease? Find the exact percentage.
What should it do to the real interest rate : Suppose a country's central bank wants to keep the real exchange rate constant. What should it do to the real interest rate if foreign economies enter recessions?
How does society change in response to the technology : How has this technology been received, accepted, or rejected? Why? Is it feared or favored? What is the attitude toward change? How are the developers trying to sell the technology to the general public? Look at attitudes, feelings (emotions), beh..
What should the firm do in the short-run : Assume this firm is making a loss when it produces its 7th unit of output. What should the firm do in the short-run? Should it operate at loss or shutdown in the short run?
Design and implement a program based on a greedy algorithm : Design and implement a program based on a greedy algorithm to solve the Minimal Spanning Tree (MST) problem; Choose and implement appropriate data structures for the algorithm; Analyse the efficiency of different implementations of the algorithm in c..
Construct a pie-chart displaying the energy shares : ECO 314: Energy and Resource Economics - Create a single spreadsheet workbook with the following tabs: Canada, U.S., China, India, U.K., Germany, France, Spain, Denmark, Japan and World.
What number of hash functions minimizes false positive rate : As a function of n, the number of bits and m the number of members in the set S, what number of hash functions minimizes the false positive rate?
Constant horizontal force : If we add 20 kJ of energy to 2 kg of liquid water originally at 20 C, 100kPa, a) How hot does it get if it is heated at constant pressure? b) How fast does it move if it is pushed by a constant horizontal force?
Are these predictions confirmed by the data : According to the theories, how should each of these events have affected South Africa's exchange rate?-  Are these predictions confirmed by the data in given Figure? Explain.

Reviews

len1220887

9/26/2016 8:11:01 AM

Your completed assignment should contain your source code including all programs and scripts, readme and report.pdf in a zipped file named ass3.zip. You should not include any graph matrices in the submission. In this assignment, all input files will be generated by your program/scripts. To submit your assignment, transfer your ass3.zip ?le to banshee and run the command: turnin -c csci203 -a 3 ass3.zip from the directory containing your ?le. If you need an extension apply through SOLS, if possible before the assignment deadline.

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd