iostream header file use in C++ program for input and output functions.iostream use the object like cin ,cout ,cerr and clog to send data to and from the standard streams input, output, error (unbuffered), and log (buffered) respectively.
Example;
#include<iostream.h>
void main( )
{
int a;
cout<<"Enter number";
cin>>a;
}
Here we use cout for print output and cin for input.
Sunday, September 30, 2018
What is a Hash Table?
HASH Table
Example
A hash table is made up of two parts: an array (the
actual table where the data to be searched is stored) and a mapping function,
known as a hash function.
HASH Table is a speedy operation to
(1):Store,
(2):Retrieve
(3):Delete
Hash Function Computes the keys(input values) to generate index:
Division Method
key (input)%
no. of slots in array = index
Consider an example:
If key is 44 then
44 % 5 = 4
Example
So the item 23 will be stored at
index 3
Q:What would happen if 2 values
comes on the same index ?
If 2 values like 23 and 33 comes on
the same index 3 then
a collision will occur.
Subscribe to:
Posts (Atom)