Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Next, create a function for the Load event of the form. This function will be executed after the form loads and it's where you'll implement
Next, create a function for the Load event of the form. This function will be executed after the form loads and it's where you'll implement the processing tasks described below. Visual Studio will flip over to your code at this point and your form class will look something like the following: public partial class Form1: Form public Form1() InitializeComponent ); private void Form1_Load (object sender, EventArgs e) integers in the range [0, 20,000] (give or take a few hundred in that range is fine). Then determine how many distinct integers are in the list with 3 different approaches. Also, have them run in the order listed below. Do not change the order. A note on what you're doing: you're taking an array of numbers and conceptually just removing duplicates and counting how many are left. If the input array was (1,1,3,5,6,6,7,7,7,9] then the distinct number set is (1,3,5,6,7,9), implying 6 distinct numbers. Do not alter the list in any way and use a hash set to determine the number of distinct integers in the list. The result will be included in the output, which is discussed more below. Also, include in the output information about the time complexity of this method. Be careful with this and 1. describe how you determined it. Use a good amount of detail, as a too sparse explanation might not be worth full points. Use the MSDN documentation to assist you Do not alter the list in any way and determine the number of distinct items it contains while keeping the storage complexity (auxiliary)at (1). Do not dynamically allocate any memory either. This means you cannot allocate additional lists, arrays, or containers of any sort. If you have an algorithm that would require more storage if the list had more items, then it is not 0(1) storage complexity. There is some leniency on the time complexity requirements for this part. Due to the strict memory requirements your method may end up being quite slow next to the other 2, but it still should execute in a matter of a few seconds on any computer made within the last 5 years Sort the list (use built-in sorting functionality) and then use a new algorithm to determine the number of distinct items with O(1) storage, no dynamic memory allocation, and O(n) time complexity. Do not alter the list further after sorting it. Determine the number of distinct items in O(n) time (not including the sorting time, which you can ignore), where n is the number of items in the list 2. 3. Output: Use either a string or StringBuilder object to compile text results from all of your methods. Put this string in the text box after completion, so that it shows up when the app runs. Examine your results before submitting your code and make sure they make sense. Obviously all 3 methods should be giving you the same answer. It should look something like the following (but of course with more details filled in where I have neglected to give you the answer) when you're finished Student Name-12345678 HashSet method: 7915 unique numbers Here you will have info about the time complexity of your code You also need info about how you deteminedit 2.0(1) storage method: 7915 unique numbers . Sorted method: 7915 unique numbers
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