Question: Suppose we want to implement a SortedList class. One option is to use an array as the underlying data structure. A second option is to

 Suppose we want to implement a SortedList class. One option is

Suppose we want to implement a SortedList class. One option is to use an array as the underlying data structure. A second option is to use a linked list doing everything "from scratch" (e.g. we would have a member Node *headPtr). A third option is to use composition with an existing LinkedList class. That means a LinkedList object will be the underlying data structure. Of course, in the last option, we only have access to the public members of LinkedList, not the private ones. The public members of LinkedList are... bool isEmpty) const: int getLength ) const: bool insert (int newPosition, const ItemType& newEntry); bool remove (int position): void clear ; ItemType getEntry(int position) const throw (PrecondViolatedExcep) void setEntry (int position, const ItemType& newEntry): For SortedList, what are the big O results for each of the following implementations. Answers will be things like o(1), O(logn), O(n) etc. Array LinkedList from scratch LinkedList via composition insertSorted (newEntry) removeSorted (anEntry) getPosition (anEntry) getEntry (position) remove (givenPosition)

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!