affiliate marketing
Showing posts with label HASHING TECHNIQUE. Show all posts
Showing posts with label HASHING TECHNIQUE. Show all posts

Monday, 12 December 2011

HASHING TECHNIQUE


HASHING TECHNIQUE

Aim:
            To implement a program using Hashing technique.

Algorithm:

            Step1: Include necessary header files
            Step2: Declare necessary variables
            Step3: Check the value of  *S
                        Then call Insert( )
                            Print “Enter the string”
                        Read S
            Step4: Check the value of *S
            Step5: Then print S by calling hGetVal( )
            Step6: Call PrintHash( )
            Step7: End

Algorithm For hINSERT( ):

            Step1: Allocate memory to pointer
            Step2: Assign index            hGetIndex ( )
            Step3: Assign Ptr            Key         Strdup(key)
                                    Ptr         Val         Val
                                    Ptr         next         h[index]
                                    h[index]        Ptr
            Step4: Print “h[index]=key”
            Step5: Return

Algorithm For hGETVALUE( ):

Step1: [Ptr=h[hGetIndex(key)]]
Step2: If[Ptr && strcmp(Ptr        key)]
                        Then Ptr          Ptr        next
Step3: If[Ptr],Check the value of Ptr
                        [Return Ptr        Val]
Step4: [Return -1]

Algorithm For PRINTHASH( ):