Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

For this question, you will develop the code to determine the nodes that have the maximum data and minimum data values in a singly linked

image text in transcribed
image text in transcribed
image text in transcribed
For this question, you will develop the code to determine the nodes that have the maximum data and minimum data values in a singly linked list-based implementation of a List (the code for this implementation is provided to you). The main function is setup to create a List of random integers. The main function has a comment indicating that you will write your code there to determine the addresses of the nodes with the maximum data and minimum data in the List and then print out the data of the corresponding nodes. You should not do any changes in the code provided for the List class. Test run your code with inputs for the list size as 10 and the range of values for the elements is [1...50] and capture the screenshot. You are given the code for a singly linked list-based implementation of the List ADT. You will add a function called is Unique to the List class such that the function will return true if all the integer elements in the List are unique and return false otherwise. The main function is written in such a way that it will create 1000 Lists (each of size listSize) of random integers in a range [1...maxValue) and will call the is Unique function to determine how many of these 1000 Lists are unique. The main function is programmed to determine the fraction of the 1000 Lists that are unique and the fraction is referred to as the probability that a List of listSize with integers in the range [1...maxValue] will be unique. You will test your code with the following values for listSize and maxValue. listSize: the last two digits of your J#. For example, if your J# is J00123456, then your listSize is 56. In case, the last two digits of your J# is a value less than 10, you will add 10 to that value and use the sum as the listSize. For example, if your J# is J00120005, then your listSize will be 10+ 05 = 15. max Value: the last four digits of your J#. For example, if your J# is J00123456, then your maxValue is 3456. In case, the last four digits of your J# is a value less than 1000, you will add 1000 to that value and use the sum as the max Value. For example, if your J# is J00120005, then your max Value will be 1000 + 0005 = 1005 State your J# as part of the documentation you submit for this question Implement the Selection Sort algorithm discussed in class to sort a list of a certain size. The list is to be implemented using a dynamic array and you are given the startup code for this purpose. The main function is also setup with the timers to evaluate the performance (sorting time) of your implementation. Note that the main function is written for you in such a way that the code will run for different values of list sizes ranging from 1000 to 20000, in increments of 1000. The inputs for the maximum value and number of trials are respectively 5000 and 50 for all cases. The code will output the average sorting time in milliseconds) for each of value of list size for the implementation. You are then required to tabulate the average sorting times observed for the implementation. Also, generate an Excel plot that displays the average sorting times (in Y-axis) for different values of the list size (in X-axis). Use the Add Trend Line option in Excel, choose the Power function option and display the equation and the R value for the curve. The R' value is expected to be closer to 1.0. Make sure the equation and the RP value are clearly visible in your Excel plot. Compare the equation you obtained from your Excel plot with the theoretical time complexity of the algorithm. For this question, you will develop the code to determine the nodes that have the maximum data and minimum data values in a singly linked list-based implementation of a List (the code for this implementation is provided to you). The main function is setup to create a List of random integers. The main function has a comment indicating that you will write your code there to determine the addresses of the nodes with the maximum data and minimum data in the List and then print out the data of the corresponding nodes. You should not do any changes in the code provided for the List class. Test run your code with inputs for the list size as 10 and the range of values for the elements is [1...50] and capture the screenshot. You are given the code for a singly linked list-based implementation of the List ADT. You will add a function called is Unique to the List class such that the function will return true if all the integer elements in the List are unique and return false otherwise. The main function is written in such a way that it will create 1000 Lists (each of size listSize) of random integers in a range [1...maxValue) and will call the is Unique function to determine how many of these 1000 Lists are unique. The main function is programmed to determine the fraction of the 1000 Lists that are unique and the fraction is referred to as the probability that a List of listSize with integers in the range [1...maxValue] will be unique. You will test your code with the following values for listSize and maxValue. listSize: the last two digits of your J#. For example, if your J# is J00123456, then your listSize is 56. In case, the last two digits of your J# is a value less than 10, you will add 10 to that value and use the sum as the listSize. For example, if your J# is J00120005, then your listSize will be 10+ 05 = 15. max Value: the last four digits of your J#. For example, if your J# is J00123456, then your maxValue is 3456. In case, the last four digits of your J# is a value less than 1000, you will add 1000 to that value and use the sum as the max Value. For example, if your J# is J00120005, then your max Value will be 1000 + 0005 = 1005 State your J# as part of the documentation you submit for this question Implement the Selection Sort algorithm discussed in class to sort a list of a certain size. The list is to be implemented using a dynamic array and you are given the startup code for this purpose. The main function is also setup with the timers to evaluate the performance (sorting time) of your implementation. Note that the main function is written for you in such a way that the code will run for different values of list sizes ranging from 1000 to 20000, in increments of 1000. The inputs for the maximum value and number of trials are respectively 5000 and 50 for all cases. The code will output the average sorting time in milliseconds) for each of value of list size for the implementation. You are then required to tabulate the average sorting times observed for the implementation. Also, generate an Excel plot that displays the average sorting times (in Y-axis) for different values of the list size (in X-axis). Use the Add Trend Line option in Excel, choose the Power function option and display the equation and the R value for the curve. The R' value is expected to be closer to 1.0. Make sure the equation and the RP value are clearly visible in your Excel plot. Compare the equation you obtained from your Excel plot with the theoretical time complexity of the algorithm

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

need a multsim diagram for 3 input binary to gray code converter

Answered: 1 week ago