Re: How to count value in a ArrayList

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



j1mb0jay wrote:
On Sat, 24 May 2008 13:35:03 -0400, Arne Vajhøj wrote:
j1mb0jay wrote:
On Sat, 24 May 2008 11:01:49 -0400, Arne Vajhøj wrote:
j1mb0jay wrote:
If you input the the data into a hash table rather than a ArrayList,
that will clone itself when it gets full and is rather slow. Then
when you want to look for an item you will only have to look at one
item to see if you have it, rather than the whole list.
Is that different from ArrayList ??
A well distributed hash table has a BigO(1) for all operations (Insert,
Search and Remove).
So does an array list for operations at the tail.

Until the backing array is full.

And a hash table has the same issue.

How can an array list have a O(1) Search, when it has to look at each item and compare. Dont be so silly !!!

Both inserting at the tail and removing from the tail is O(1).
Technically speaking searching at the tail is also O(1), but there
is not much point in that.

Arne
.