Question
In C# please- i cant figure out how to word the exception in a linkedlist- like how what do i put in the if statement
In C# please- i cant figure out how to word the exception in a linkedlist- like how what do i put in the if statement
void AddAfter(T element, T oldElement)
The same as AddAfter(), but adds after the first node found with the specified oldElement
value.
NOTE: We start from the head and move to the tail when searching for oldElement’s
value.
here is the AddAfter() for reference
void AddAfter(T element, int position)
Finds the Node at the position specified and adds a new node after it.
NOTE: The head is position 1.
1. Size: Increases by 1 when a node (containing an element) is added to the LinkedList.
2. Head: Will never change.
3. Tail: May need to be changed, if the position to add after is the size of the list.
4. Exceptions: Throw an error if the position provided is not valid: zero, negative or above the size of the list.
5. Returns: Nothing.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Certainly Heres an example implementation of the AddAfter method in C for a LinkedList considering the requirements mentioned csharp using System clas...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