Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. ADT List: defines a set of operations to interact with its data, which implementations must provide. It is a fundamental structure used in many

image text in transcribed

1. ADT List: defines a set of operations to interact with its data, which implementations must provide. It is a fundamental structure used in many computing applications. This question concerns the data type List. (a) One List operation, (returns element) set(int pos, E element), returns the element previously present at the specified position in the list, and sets the specified new element. Name and describe the behaviour of 3 other operations you would expect to find in a List implementation. Your descriptions should include any input parameters and a return type, if required. (b) Select two of the operations you've identified in (a), along with a List implementation strategy. Briefly explain and quantify the algorithmic complexity (preferably in Big O notation) of both these operations with your chosen implementation strategy. (c) One implementation strategy for the ADT List is a Linked List, where each item is represented by a Node containing the element value to be stored and a reference to the next node; e.g. public class Node E{ E element; Node E next; 3 Assume the following class definition for the Linked List itself, which defines the list's head and the required ADT List operations: public class LinkyList \{ Node E head; 3 Assuming a List implementation as above and that LinkyList does not maintain a specific size variable, describe the implementation of an instance method LinkyList.set(int pos, E element). This method should replace the element at the specified position, returning the element previously at the specified position. An error should be generated if the specified position is out of range. Note: For this question, you should answer in a Java-like pseudo-code, including a method signature/header. This should be recognisable to a Java programmer, but you will not be penalised for syntax errors, providing your code is understandable

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions