Question: c# Program 1 UnOrderedArrayList Ordered/Unordered Lists 100 points Modify the supplied class UnorderedArrayList the following ways the method remove() removes an element from the list

c#

c# Program 1 UnOrderedArrayList Ordered/Unordered Lists 100 points Modify the supplied class

Program 1

UnorderedArrayList the following ways the method remove() removes an element from the

UnOrderedArrayList

list by shifting the elements of the list. However, if the element

to be removed is at the beginning of the list and the

Ordered/Unordered Lists 100 points Modify the supplied class UnorderedArrayList the following ways the method remove() removes an element from the list by shifting the elements of the list. However, if the element to be removed is at the beginning of the list and the list is fairly large, it could take a lot of computer time to perform the operation. Because the list elements are in no particular order, you could simply remove the element by copying the last element in the list at the position of the item to be removed and reducing the length of the list. a. b. the method remove removes only the first occurrence of an element. Add the method c. add the methods min( and max() which will return the smallest and largest respective d. add an insertion sort method that puts the list in order removeAlI) that will remove all occurrences of a given element. elements in the list write a Main() method that thoroughly tests these modifications and demonstrates correctness e. using System; using System.Collections.Generic; using System. Linq; using System.Text; using UnorderedArrayListNamespace; 2 4 7 namespace test 8 class Program 10 static void Main(string[ args) 12 13 UnorderedArrayList u u.printOsl int var5; u.insert(ref var); var12; u.insert (ref var); var = 2; u.insert (ref var); var = 29; u.insert (ref var); u.print(; var = 5; u.remove(ref var); u.print(; new UnorderedArrayList(); 15 16 17 20 21 23 25 26 27 28 29 30 using System; 1 2 3 namespace UnorderedArrayListNamespace 4 public class UnorderedArrayList protected int[] list; protected int next; 9 10 public UnorderedArrayList() 12 13 list- new int [100]; next 0; 15 16 public void insert (ref int item) list[next] next++; item; 19 20 21 = 23 24 25 26 27 public void remove(ref int item) if (next-0) else 29 30 31 32 //find value, if it exists for (int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!