Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java implement the Map ADT based on Skip List, which is in Section 10.4. That means implementing all the 8 functions based on Skip

In Java implement the Map ADT based on Skip List, which is in Section 10.4. That means implementing all the 8 functions based on Skip List and run your codes on Example 10.1. Your program should print out that table in Example 10.1

Functions:

image text in transcribedimage text in transcribed

nce a map stores a collection of objects, it should be viewed as a collection of y-value pairs. As an ADT, a map M supports the following methods: size( ): Returns the number of entries in M. isEmpty( ): Returns a boolean indicating whether M is empty. get (k) : Returns the value v associated with key k, if such an entry exists; otherwise returns null. put(k,v) : If M does not have an entry with key equal to k, then adds entry (k,v) to M and returns null; else, replaces with v the existing value of the entry with key equal to k and returns the old value. remove( (k) : Removes from M the entry with key equal to k, and returns its value; if M has no such entry, then returns null. keySet( ): Returns an iterable collection containing all the keys stored in M. values( ): Returns an iterable collection containing all the values of entries stored in M (with repetition if multiple keys map to the same value). entrySet ( ): Returns an iterable collection containing all the key-value entries in M. \begin{tabular}{|c|c|c|} \hline \hline Method & Return Value & Map \\ \hline isEmpty() & true & \{\} \\ put (5,A) & null & {(5,A)} \\ put (7,B) & null & {(5,A),(7,B)} \\ put (2,C) & null & {(5,A),(7,B),(2,C)} \\ put (8,D) & null & {(5,A),(7,B),(2,C),(8,D)} \\ put (2,E) & C & {(5,A),(7,B),(2,E),(8,D)} \\ get (7) & B & {(5,A),(7,B),(2,E),(8,D)} \\ get(4) & null & {(5,A),(7,B),(2,E),(8,D)} \\ get(2) & E & {(5,A),(7,B),(2,E),(8,D)} \\ size() & 4 & {(5,A),(7,B),(2,E),(8,D)} \\ remove (5) & A & {(7,B),(2,E),(8,D)} \\ remove(2) & E & {(7,B),(8,D)} \\ get(2) & null & {(7,B),(8,D)} \\ remove (2) & null & {(7,B),(8,D)} \\ isEmpty () & false & {(7,B),(8,D)} \\ entrySet () & {(7,B),(8,D)} & {(7,B),(8,D)} \\ keySet() & {7,8} & {(7,B),(8,D)} \\ values() & {B,D} & {(7,B),(8,D)} \\ \hline \hline \end{tabular}

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

Database And Expert Systems Applications Dexa 2021 Workshops Biokdd Iwcfs Mlkgraphs Al Cares Protime Alsys 2021 Virtual Event September 27 30 2021 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Anna Fensel ,Jorge Martinez-Gil ,Lukas Fischer

1st Edition

3030871002, 978-3030871000

Students also viewed these Databases questions

Question

Describe the factors influencing of performance appraisal.

Answered: 1 week ago

Question

What is quality of work life ?

Answered: 1 week ago

Question

4. Identify the challenges facing todays organizations

Answered: 1 week ago