Question
OurList Class IN C# using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections; namespace MyPrograms { public class OurList : ICollection ,
OurList Class IN C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections;
namespace MyPrograms { public class OurList
mTmp.Next = new Node(value, null); } } public void RemoveLast() { if (first == null) return; else if (first.Next == null) RemoveFirst(); else { Node pTmp = first; while (pTmp.Next.Next != null) pTmp = pTmp.Next;
pTmp.Next = null; } } public void InsertAt(int index, T value) { if (index >= 0 && index
pTmp.Next = new Node(value, pTmp.Next); } } else throw new ArgumentOutOfRangeException(); } public void RemoveAt(int index) { if (index >= 0 && index GetEnumerator() { Node pTmp = first; while (pTmp != null) { yield return pTmp.Data; pTmp = pTmp.Next; } } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public override string ToString() { if (IsEmpty() == true) return string.Empty; StringBuilder returnString = new StringBuilder(); foreach (T item in this) { if (returnString.Length > 0) returnString.Append(":"); returnString.Append(item); } return returnString.ToString(); } } }
Linked List Add a method to the OurList class that accepts a list and counts how many items are on this list and are not on the list that is passed into this method. Assume none of the lists contain duplicates. Make sure the method is efficient. Example: List1: 5, 17, 10, 9, 2 List2: 9, 17, 3,8 Result: when method is called using List1 and method is passed List2, the method returns 3 since 5, 10, and 2 are on List1 and not on List2 when method is called using List2 and method is passed List1, the method returns 2 since 3 and 8 are on List2 and not on List1 Linked List Add a method to the OurList class that accepts a list and counts how many items are on this list and are not on the list that is passed into this method. Assume none of the lists contain duplicates. Make sure the method is efficient. Example: List1: 5, 17, 10, 9, 2 List2: 9, 17, 3,8 Result: when method is called using List1 and method is passed List2, the method returns 3 since 5, 10, and 2 are on List1 and not on List2 when method is called using List2 and method is passed List1, the method returns 2 since 3 and 8 are on List2 and not on List1Step 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