68 329
Assignments Done
Successfully Done
In November 2018

Answer to Question #54345 in C# for keivan

Question #54345
I want to have a simple code that demonstrtes hasch table and its concept.
Expert's answer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

Hashtable class is designed to create a collection in which to store its elements is a hash table.
* Information is stored in a hash table by using a mechanism called hashing.
* When hashing to determine the unique value called a hash code, using the information content of a special key.
* Summarized hash code serves as an index into a table in which desired data stored corresponding to the specified key.
* Converting a key in the hash code is executed automatically,
* and therefore it is the hash code is not available to the user at all. The advantage of hashing is that it provides a constant-time search operations, retrieving and setting values ​​irrespective of the magnitude data arrays.

namespace HashExample
class Program
static void Main(string[] args)
// Create a hash table
Hashtable htexample = new Hashtable();

// Добавим несколько записей
htexample.Add("BillGates5", "123bg");
htexample.Add("ElonMAsk", "345em");
htexample.Add("SteveJobs", "678SJ");

// We consider the collection of keys
ICollection keys = htexample.Keys;

foreach (string s in keys)
Console.WriteLine(s + ": " + htexample[s]);



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions