If McDonalds were run like a software company, one out of every hundred Big Macs would give you food poisoning, and the response would be, ‘We’re sorry, here’s a coupon for two more.’ “ Mark Minasi

Set implementation

Language Java | Level Intermediate | Category Data structure | September 9, 2015 9:33 am

Data structure Description

The set is a data structure that can store values without any order and do not contain duplicate elements. The set is a computer implementation of a finite set. It contains finite natural number of elements. The subset is a set build from master set and has few elements. Example, Set S={1, 2, 3, 4, 5}, Subset = { {1, 2, 3}, {2, 3}, {1}}. The set can be implemented using linked lists, vectors and hash tables. It can be static and dynamic. Static set cannot change the elements after constructing the elements. The dynamic set can add or remove the elements after construction. The static set contains build and ternate the elements from the set. But the dynamic set support add, remove operations too.

Multiset or bag is the generalization of the set which support multiple duplicate values. Multisets can naturally be implemented using the hash table or trees.

Write a program to implement the set operations.



Itmes in the set: [One”,two”,Three”,four”,five”,”]
Set size: 5
Does Set contains 'One' : true
Itmes in the set: [One”,two”,Three”,four”,five”,ten”,null”,null”,null”,null”,”]



No comments available!

Please login to add comments.