Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Section 7.3.2, implement the Positional List Abstract Data Type. That means implementing all the 12 functions and run your code on Example 7.4 Your program
Section 7.3.2, implement the Positional List Abstract Data Type. That means implementing all the 12 functions and run your code on Example 7.4 Your program should print out that table in Example 7.4. (Java)
Functions:
first ( ): Returns the position of the first element of L (or null if empty). last( ): Returns the position of the last element of L (or null if empty). before (p) : Returns the position of L immediately before position p (or null if p is the first position). after(p) : Returns the position of L immediately after position p (or null if p is the last position). isEmpty( ): Returns true if list L does not contain any elements. size( ): Returns the number of elements in list L. addFirst(e) : Inserts a new element e at the front of the list, returning the position of the new element. addLast (e) : Inserts a new element e at the back of the list, returning the position of the new element. addBefore (p,e) : Inserts a new element e in the list, just before position p, returning the position of the new element. addAfter(p,e) : Inserts a new element e in the list, just after position p, returning the position of the new element. set(p,e): Replaces the element at position p with element e, returning the element formerly at position p. remove (p) : Removes and returns the element at position p in the list, invalidating the position. Example 7.4: The following table shows a series of operations on an initially empty positional list storing integers. To identify position instances, we use variables such as p and q. For ease of exposition, when displaying the list contents, we use subscript notation to denote the position storing an elementStep 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