answersLogoWhite

0


Best Answer

Array list and linked list are very effective Data Structures. However, ArrayLists are not effective for adding and removing elements in between and Linked Lists take a lot of time when iterating through the elements. A HashSet is effective in both aspects. However, the selection of HashSet is better if the data we enter needs to be traversed while addition and removing is frequent. Further, HashSet cannot have duplicates. So in places where we need to avoid duplicating data, HashSet would be the key.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the advantages of HashSet over Array?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What are Advantages of using gate array in digital design?

The advantages of using an array are that lists of the same data types can be stored easily without the need for a connection to a database. For example, a list of names can be stored in an array and only one variable need be declared. - Mike Hoerger


Difference between HashSet and Linkedhash set in java?

The only difference is that the LinkedHashSet maintains the order of the items added to the Set. It does this by maintaining a doubly linked list containing the hash and the original order of the items. According to Sun, the LinkedHashSet should run nearly as fast as the HashSet.LinkedHashSet A LinkedHashSet is an ordered version of HashSet thatmaintains a doubly-linked List across all elements. Use this class instead of HashSetwhen you care about the iteration order. When you iterate through a HashSet theorder is unpredictable, while a LinkedHashSet lets you iterate through the elementsin the order in which they were inserted.HashSet A HashSet is an unsorted, unordered Set. It uses the hashcodeof the object being inserted, so the more efficient your hashCode() implementationthe better access performance you'll get. Use this class when you want a collectionwith no duplicates and you don't care about order when you iterate through it.


What are the advantages of linked list over arrays?

# Linked lists do not need contiguous blocks of memory; extremely large data sets stored in an array might not be able to fit in memory. # Linked list storage does not need to be preallocated (again, due to arrays needing contiguous memory blocks). # Inserting or removing an element into a linked list requires one data update, inserting or removing an element into an array requires n (all elements after the modified index need to be shifted).


Can you give an example of array using character variable in c program?

the example of array over charcter variables is char ["string"]


What are the advantages of using a foreach loop over a for or while loop for processing list elements?

foreach can simply replace for loop. for ex in perl, if you need to copy display an array, it will take only foreach $var(@arr). then print $var. no need of incrementing the index of array like for loop.

Related questions

What is an array and explain its advantages and disadvantages?

what is array? explain with its advantage.


What is difference between tree set hashset?

Hashset is not allow duplication, order element TreeSet is allow sorted order and not allow duplication HashSet store any type object but Treeset can store only one type( its following type safe mechanisam String or Integer) Hashset faster than TreeSet because elemnts aor store in hash alogirthm


What are Advantages of using gate array in digital design?

The advantages of using an array are that lists of the same data types can be stored easily without the need for a connection to a database. For example, a list of names can be stored in an array and only one variable need be declared. - Mike Hoerger


What are advantages and disadvantages of merging?

merge sort is the most efficient way of sorting the list of array.


Difference between HashSet and Linkedhash set in java?

The only difference is that the LinkedHashSet maintains the order of the items added to the Set. It does this by maintaining a doubly linked list containing the hash and the original order of the items. According to Sun, the LinkedHashSet should run nearly as fast as the HashSet.LinkedHashSet A LinkedHashSet is an ordered version of HashSet thatmaintains a doubly-linked List across all elements. Use this class instead of HashSetwhen you care about the iteration order. When you iterate through a HashSet theorder is unpredictable, while a LinkedHashSet lets you iterate through the elementsin the order in which they were inserted.HashSet A HashSet is an unsorted, unordered Set. It uses the hashcodeof the object being inserted, so the more efficient your hashCode() implementationthe better access performance you'll get. Use this class when you want a collectionwith no duplicates and you don't care about order when you iterate through it.


What are the advantages of linked list over arrays?

# Linked lists do not need contiguous blocks of memory; extremely large data sets stored in an array might not be able to fit in memory. # Linked list storage does not need to be preallocated (again, due to arrays needing contiguous memory blocks). # Inserting or removing an element into a linked list requires one data update, inserting or removing an element into an array requires n (all elements after the modified index need to be shifted).


Can you give an example of array using character variable in c program?

the example of array over charcter variables is char ["string"]


What are advantages of hartnell over porter governor?

advantages of hartnell governor over porter governor


What advantages do corporations have over small businesses?

List two advantages that corporation have over a small business


What does array map do in php?

The array_map function in PHP loops over each elements of the passed array(s), and runs the given function. It then returns a new array that contains the values returned by each call to the given function.


Describe the advantages and disadvantages of array in data structure?

Array Pros:can access any element of an array directlycan be used to create other useful data structures (queues, stacks)light on memory usage compared to other structuresArray Cons:rigid structurecan be hard to add/remove elementscannot be dynamically resized in most languages


What advantages does the iPod Nano have over the iPod Touch?

No advantages whatsoever...