7
Reply

What are differences between Array list and Hash table?

Ankur Jain

Ankur Jain

11y
20.5k
0
Reply
    ArrayList--> Index based. HashTable-->Key based.
    1) Hash table store data as name, value pair. While in array only value is store. 2) To access value from hash table, you need to pass name. While in array, to access value, you need to pass index number. 3) you can store different type of data in hash table, say int, string etc. while in array you can store only similar type of data.

    I think the main difference is that an ArrayList stores elements in an ordered sequence and allows access by index, while a Hashtable stores data as key-value pairs for fast lookups. Each structure is useful in different situations depending on how the data needs to be accessed and managed. I always find it helpful to understand the strengths and limitations of each data structure before choosing one for a project. Even when I’m taking a break with Basket Random, I enjoy learning about programming concepts that can improve code efficiency and organization.

    Such a waste of time.. People are confused with simple basics. Go first and check the difference between an array and an arraylist. C# corner , we expect better from you.
    I agree with Rohit, please do not put any invalid comments and content, question is for difference between arraylist and hashtable, people refer these sites for interview, do not post wrong answers
    Hashtable is key/value pair based collection where Arraylist is index based. arraylist canbe easily sorted but hashtable is not.
    Duffer Ankur we are talking about ArrayList not Array. First you read the question then post your answer