Looking for work? Check out our jobs area.

ASP.NET

Moderators: None (Apply to moderate this forum)
Number of threads: 1528
Number of posts: 3022

This Forum Only
Post New Thread

Report
What is the difference between HASH TABLE and ARRAY Posted by aarunlal on 7 Sept 2005 at 4:38 AM
WHat is the difference between a Hash Table and array ??

regards
arunlal
Report
Re: What is the difference between HASH TABLE and ARRAY Posted by iwilld0it on 7 Sept 2005 at 6:21 AM
: WHat is the difference between a Hash Table and array ??
:
: regards
: arunlal
:

An array is a collection of data, where each data item (element) has to be the the same data type. Array elements are allocated consecutively in the same memory space and are indexed via an integer index.

Creating a VB Array:

Dim names(1) As String

names(0) = "John Doe"
names(1) = "Jane Doe"


This is an array of strings. You can create an array of any object ...

Dim arr(20) As CustomObject


Indexing an array ...

' Writes: Hello Jane Doe
Response.Write("Hello " & names(1))


Hash table is a data structure that provides lookup semantics via an object key. Typically the key is a string, however under .NET, it can be any Object and particualy objects that provide a decent override of the Base Objects GetHashCode() function. A hash code is an algorithically generated id that should make an object key distinct.

Creating a hashtable:

Dim lookup As New HashTable()

lookup("NY") = "New York"
lookup("PA") = "Pennsylvania"
' ...


In this example, "NY" and "PA" are the lookup keys, while the items after the equal sign are the values to store.

Using the hashtable ...

' Writes: I am from New York
Response.Write("I am from " & lookup("NY").ToString())


There is really more to these data structures than the basic descriptions I am giving you.

For instance under .NET, arrays are objects that derive from the base Array class and implement IEnumerable so that array elements can be enumerated with a For-Each loop.

Hash tables hold a collection of DictionaryEntry objects, where a DictionaryEntry holds the Key along with its value.

You really have to read more into this online.





Report
Re: What is the difference between HASH TABLE and ARRAY Posted by aarunlal on 7 Sept 2005 at 10:35 PM
This message was edited by aarunlal at 2005-9-7 22:44:15

Thnak u very much Mr.iwilld0it ..

Can you send some good urls regarding this ..

regards
Arunlal



: : WHat is the difference between a Hash Table and array ??
: :
: : regards
: : arunlal
: :
:
: An array is a collection of data, where each data item (element) has to be the the same data type. Array elements are allocated consecutively in the same memory space and are indexed via an integer index.
:
: Creating a VB Array:
:
:
: Dim names(1) As String
: 
: names(0) = "John Doe"
: names(1) = "Jane Doe"
: 

:
: This is an array of strings. You can create an array of any object ...
:
:
: Dim arr(20) As CustomObject
: 

:
: Indexing an array ...
:
:
: ' Writes: Hello Jane Doe
: Response.Write("Hello " & names(1))
: 

:
: Hash table is a data structure that provides lookup semantics via an object key. Typically the key is a string, however under .NET, it can be any Object and particualy objects that provide a decent override of the Base Objects GetHashCode() function. A hash code is an algorithically generated id that should make an object key distinct.
:
: Creating a hashtable:
:
:
: Dim lookup As New HashTable()
: 
: lookup("NY") = "New York"
: lookup("PA") = "Pennsylvania"
: ' ...
: 

:
: In this example, "NY" and "PA" are the lookup keys, while the items after the equal sign are the values to store.
:
: Using the hashtable ...
:
:
: ' Writes: I am from New York
: Response.Write("I am from " & lookup("NY").ToString())
: 

:
: There is really more to these data structures than the basic descriptions I am giving you.
:
: For instance under .NET, arrays are objects that derive from the base Array class and implement IEnumerable so that array elements can be enumerated with a For-Each loop.
:
: Hash tables hold a collection of DictionaryEntry objects, where a DictionaryEntry holds the Key along with its value.
:
: You really have to read more into this online.
:
:
:
:
:
:






 
Popular resources and forums for programmers on Programmersheaven.com
Assembly, Basic, C, C#, C++, Delphi, Java, JavaScript, Pascal, Perl, PHP, Python, Ruby, Visual Basic
© Copyright 2009 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin. Read the latest words from the publisher here.
Be the first to sign up for Lars Hagelin’s In-depth Outsourcing Newsletter here.
bootstrapLabs Logo A bootstrapLabs project.