Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this assignment you are to write a Python program to implement heapsort algorithm & apply it on a provided list. You are provided with
In this assignment you are to write a Python program to implement heapsort algorithm & apply it on a provided list.
You are provided with the template in which you must:
implement Phase II of a heapsort algorithm:
function that sifts down the value of the heap root to a correct position, and
function that finds the largest child of a given heap node.
Your program must:
take a file containing input list of values as a command line argument and print the original list,
create a heap form a given list of values and print created heap,
sort given list using heapsort algorithm and print sorted list.
Following is the output of the program run applied on a provided test file:
Together with your source code include a separate file Namingformat.py with your information as the values of the
following variables:
myName 'firstname lastname'
myTechID
myTechEmail 'abc #only your email id omit @latech.edu
You must properly cite the sources if you use any help from peers or any codeideas from online resources. Failure to do
so will be treated as a plagiarism. Properly citing the sources should be done as a comment in your code. Some examples:
# found this code at:
# used idea from:
# helped me with this part
python heapsort.py test.txt
Original list:
Heapified list:
Heap size:
Heap capacity:
Elements of heap:
Value: at index:
Value: at index:
Value: at index:
Value: at index:
Value: at index:
Value: at index:
Value: at index:
Value: at index:
Value: at index:
Value: at index:
Sorted list:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started