Posts

Showing posts from May, 2022

INDEGREE OUTDEGREE & TOTAL DEGREE OF VERTEX IN GRAPH

           INDEGREE       OUTDEGREE       TOTAL DEGREE     OF VERTEX IN GRAPH //graph //indegree outdegree and total degree #include < stdio.h >     int main ()   {     int a [ 10 ][ 10 ], i , j , in , out , total , n ;     printf ( " plz enter the no of vertices: " );     scanf ( " %d " , & n );       for ( i = 0 ; i < n ; i ++ )       {         for ( j = 0 ; j < n ; j ++ )           {             a [ i ][ j ] = 0 ;             if ( i != j )               {                   printf ( " is edge between %d and %d : " , i + 1 , j + 1 );                   scanf ( " %d " , & a [ i ][ j ])...

DIJKSTRA SHORTEST PATH ALGORITHM:

  links:                                          Hobbies:                                             Sketches The Girl...                                         Small Unwonderful Story  Programming Languages:                                   C++                                JAVA                                HTML       Something:         ...

GRAPH TRAVERSAL : BFS & DFS

  GRAPH TRAVERSL:     1]  BFS    2] DFS BFS: //bfs #include < stdio.h >   #define maxsize 20   typedef struct node   {       int data [ maxsize ];       int front , end ;   } queue ;   int initq ( queue * pq )     {       pq -> front = pq -> end =- 1 ;     }   int isempty ( queue * pq )     {       return ( pq -> end == pq -> front );     }   void enqueue ( queue * pq , int n )     {         pq -> data [ ++ pq -> end ] = n ;     }   int dequeue ( queue * pq )     {         return pq -> data [ ++ pq -> front ];     }   int bfs ( int a [ 4 ][ 4 ], int n )     {       int w , v ;       int visited [ 25 ] = { 0 };       queue q ; ...

Raspberry pi & Arduino programs

  Raspberry pi programs: # led interfacing raspberry pi # to study and understand led interfacing raspberry pi from RPi . GPIO import * import time setwarnings ( False ) setmode ( BCM ) setup ( 4 , OUT ) while True :     output ( 4 , HIGH )     time . sleep ( 2 )     output ( 4 , LOW )     time . sleep ( 3 )     # switch interfacing raspberry pi # to study and understand interfacing switch connect to the raspberry pi from RPi . GPIO import * import time setwarnings ( False ) setmode ( BCM ) setup ( 4 , OUT ) setup ( 17 , IN ) while True :     button_state = input ( 17 )     if button_state == False :         output ( 4 , False )         print ( " Button pressed... " )         while input ( 17 ) == False :             time . sleep ( 2 )     else :         output ( 4 , True ) #te...

hash table

  hash table: //IMPLEMENTATION OF STATIC HASH TABLE WITH LINEAR PROBING: #include < stdio.h > #include < stdlib.h > int h [ 10 ] = { NULL }; void insert ()   {     int key , index , i , hkey ;     printf ( "\n Hey plz enter a value to insert into hash table: \n" );     scanf ( " %d " , & key );     hkey = key % 10 ;       for ( i = 0 ; i < 10 ; i ++ )       {         index = ( hkey + i ) % 10 ;           if ( h [ index ] == NULL )           {             h [ index ] = key ;             break ;           }       }     if ( i == 10 )       printf ( "\n Ohh..element cannot be inserted \n" );   }   int search ()   {     int key , index , i , hkey ;   ...