Question

data structure class 1- what are the two primary different implementations of ADT Bag 2- what...

data structure class

1- what are the two primary different implementations of ADT Bag

2- what are the operations that bag offers with examples

answer for all of them please

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. The bag is the most basic of collection data structures, and hence almost any application that does not require remembering the order that elements are inserted will use a variation on a bag.

One implementation of ADT Bag is a spelling checker. An on-line checker would place a dictionary of correctly spelled words into a bag. Each word in the file is then tested against the words in the bag, and if not found it is flagged.

Another implementation of ADT Bag is Maintaining Dictionary.

2. The operations that Bag offers are : Intersection, Union, Difference and Subset. In addition to all the bag operations, several functions that work on two sets. These include forming the intersection, union or difference of two sets, or testing whether one set is a subset of another.

Example is given in the image :

Add a comment
Know the answer?
Add Answer to:
data structure class 1- what are the two primary different implementations of ADT Bag 2- what...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The ADT Bag is a group of items, much like what you might have with a...

    The ADT Bag is a group of items, much like what you might have with a bag of groceries. In a software development cycle, specification, design, implementation, test/debug, and documentation are typical activities. The details are provided in the rest of the document. ADT Bag Specification: (Note: You should not change the names of the operations in your program. This should be included in an interface.) Specify operations to  create an empty bag that can hold up to 100...

  • Multiple Choice Multiple Choice Section 3.1 The Bag ADT For the bag class in Chapter 3...

    Multiple Choice Multiple Choice Section 3.1 The Bag ADT For the bag class in Chapter 3 (using a fixed array and a typedef statement) what steps were necessary for changing from a bag of integers to a bag of double values? A. Change the array declaration from int data[CAPACITY] to double data[CAPACITY] and recompile. B. Change the int to double in the typedef statement and recompile. C. Round each double value to an integer before putting it in the bag....

  • In this assignment you will be implementing two Abstract Data Types (ADT) the Queue ADT and...

    In this assignment you will be implementing two Abstract Data Types (ADT) the Queue ADT and the Stack ADT. In addition, you will be using two different implementations for each ADT: Array Based Linked You will also be writing a driver to test your Queue and Stack implementations and you will be measuring the run times and memory use of each test case. You will also be adding some functionality to the TestTimes class that you created for Homework 1....

  • Need a help with this one FoodListInterface.java specifies a Java interface for an ADT that maintains...

    Need a help with this one FoodListInterface.java specifies a Java interface for an ADT that maintains a list of foods, dishes or meals. This interface includes two operations: add(String food) – add the name of a food, dish or meal to the list onTheMenu(String food) – check if a given food item is on the list Develop three implementations of this interface, each with a different underlying data structure: Array Linked list ArrayList from the java.util package (a Java Collections...

  • please answer all questions thanks Question 21 Not yet In a linked-node implementation of a ADT,...

    please answer all questions thanks Question 21 Not yet In a linked-node implementation of a ADT, node does not reference the data in another node answered Points out of 2.00 Select one: True P Flag question False Question 23 Not yet An array implementation of an ADT potentially wastes more space than a linked implementation answered Points out of 2.00 Select one: True P Flag question False Question 25 Should Node be a public class? Briefly explain Not yet answered...

  • 1. What is protein structure? 2. Why is it important to know the primary structure? 3....

    1. What is protein structure? 2. Why is it important to know the primary structure? 3. What are the secondary structure elements in proteins? 4. How do we study protein structure? Mention at least 2 techniques. 5. What are some examples of basic amino acids and acidic amino acids?

  • Consider two different implementations of the same instruction set architecture. There are 5 classes of instructions,...

    Consider two different implementations of the same instruction set architecture. There are 5 classes of instructions, A, B, C, D, and E. The clock rate and CPI of each class is given in the following table. Machine Clock Rate CPI class A CPI class B CPI class C CPI class D CPI class E P1 1.0 GHz 1 1 2 3 2 P2 1.5 GHz 1 2 3 4 3 What are the performances of P1 and P2 expressed in...

  • Question 1: Consider two different implementations, M1 and M2, of the same instruction set. There are...

    Question 1: Consider two different implementations, M1 and M2, of the same instruction set. There are four classes of instructions (A, B, C, and D) in the instruction set. M1 has a clock rate of 500 MHz while M2’s clock rate is 750 MHz. The average number of cycles for each instruction class of M1 and M2 are shown in the following table: Class CPI for this class on M1 CPI for this class on M2 A 1 2 B...

  • Consider two different implementations of the same instruction set architecture. The instructions can be divided into...

    Consider two different implementations of the same instruction set architecture. The instructions can be divided into four classes according to their CPI (class A, B, C, and D). P1 with a clock rate of 2.5 GHz and CPIs of 2, 4, 3, and 2 and P2 with a clock rate of 3.5 GHz and CPIs of 3, 3, 2, and 3. a. Given a program with a dynamic instruction count of 1.0E8 instructions divided into classes as follows: 30% class...

  • put answers in different words What is a linked data structure? What is a node? What...

    put answers in different words What is a linked data structure? What is a node? What are the benefits of linked structure? What are the drawbacks of linked structure? What are the differences between singly linked and doubly linked structures? Give examples of when a linked structure could be used What is a linked data structure? What is a node? What are the benefits of linked structure? What are the drawbacks of linked structure? What are the differences between singly...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT