Hash Tables

Posted on Updated on

hjhgjghjghjHash Tables

The Hashtable class speaks to a gathering of key-and-esteem combines that are composed in view of the hash code of the key. It utilizes the way to get to the components in the accumulation. A hash table is utilized when you have to get to components by utilizing key, and you can recognize a helpful key quality. Every thing in the hash table has a key/quality pair. The key is utilized to get to the things in the gathering.

The accompanying case exhibits the idea: 

using System;

using System.Collections;

namespace CollectionsApplication

{

class Program

{

static void Main(string[] args)

{

Hashtable ht = new Hashtable();

ht.Add(“001”, “Zara Ali”);

ht.Add(“002”, “Abida Rehman”);

ht.Add(“003”, “Joe Holzner”);

ht.Add(“004”, “Mausam Benazir Nur”);

ht.Add(“005”, “M. Amlan”);

ht.Add(“006”, “M. Arif”);

ht.Add(“007”, “Ritesh Saikia”);

if (ht.ContainsValue(“Nuha Ali”))

{

Console.WriteLine(“This student name is already in the list”);

}

else

{

ht.Add(“008”, “Nuha Ali”);

}

// Get a collection of the keys.

ICollection key = ht.Keys;

foreach (string k in key)

{

Console.WriteLine(k + “: ” + ht[k]);

}

Console.ReadKey();

}

}

}

Collection classes are specific classes for information stacks,queues and recovery. These classes give backing to stacks, lines, records, and hash tables. Most gathering classes actualize the same interfaces. Accumulation classes fill different needs, for example, designating memory powerfully to components and getting to a rundown of things on the premise of a list and so on. These classes make accumulations of objects of the Object class, which is the base class for all information sorts in C#.

Various Collection Classes and Their Usage

ArrayList

It speaks to requested accumulation of an article that can be filed separately.It is fundamentally a different option for an exhibit. Be that as it may, dissimilar to cluster you can include and expel things from a rundown at a predetermined position utilizing a record and the exhibit resizes itself naturally. It likewise permits dynamic memory allotment, including, looking and sorting things in the rundown.

Hashtable

It utilizes a key to get to the components in the gathering. A hash table is utilized when you have to get to components by utilizing key, and you can recognize a helpful key quality. Every thing in the hash table has a key/worth pair. The key is utilized to get to the things in the accumulation.

SortedList

It utilizes a key and additionally a list to get to the things in a rundown. A sorted rundown is a blend of a cluster and a hash table. It contains a rundown of things that can be gotten to utilizing a key or a record. In the event that you get to things utilizing a file, it is an ArrayList, and on the off chance that you get to things utilizing a key , it is a Hashtable. The accumulation of things is constantly sorted by the key worth.

Stack

It speaks to a toward the end in, first out gathering of article. It is utilized when you require a toward the end in, first-out access of things. When you include a thing in the rundown, it is called pushing the thing and when you uproot it, it is called popping the thing.

Queue

It speaks to a first-in, first out accumulation of article.It is utilized when you require a first-in, first-out access of things. When you include a thing in the rundown, it is called enqueue and when you uproot a thing, it is called deque.

BitArray

It speaks to a variety of the parallel representation utilizing the qualities 1 and 0. It is utilized when you have to store the bits yet don’t have the foggiest idea about the quantity of bits ahead of time. You can get to things from the BitArray accumulation by utilizing a number file, which begins from zero.

*****************************************************************************************************

For more details and queries please feel free to email, visit or call us. Wishing you the very best for all your future endeavors.
Helpline: 9814666333, 8699444666
Email: info@technocampus.co.in

Please fill the form and we shall contact you soon.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s