Skip to main content

Posts

Featured

Bellman Ford Algorithm C program

//by Hariom Yadav //Date : 6th - 9th Nov'14 #include<stdio.h> //#include<alloc.h> struct GraphNode { int node_wt ; struct AdjNode * adr_of_adj_LL ; int parent_node_no ; int no_of_adj_node ; }; struct AdjNode { int node_no ; int dist_bt_node ; struct AdjNode * next_LL_adr ; }; #define INF 999; main () { struct GraphNode my_all_node [ 5 ]; struct AdjNode * my_adj_node , * frnd_adj_node , * frnd ; int i , k , s_node , frnd_node_no ; printf ( " \n We are taking graph as 5 node \n " ); //graph details.. for ( i = 0 ; i < 5 ; i ++ ) //number of adjacent vertex { printf ( " \n Enter total number of adjacent node to %d \n " , i ); scanf ( "%d" , & my_all_node [ i ]. no_of_adj_node ); } for ( i = 0 ; i < 5 ; i ++ ) { if ( my_all_node [ i ]. no_of_adj_node > 0 ) { for ( k = 0 ; k < my_all_node [ i ]. no_of_adj_node ; k ++ ) { my_adj_node = malloc ( sizeof

Latest Posts

extern Keyword Explanation in C-programming

A Deep inside my HTC Desire HD - Main Memory and Cache Memory Structure

Tower of Hanoi (TOH) function call

Inside My Smartphone

RAM ROM & Internal Memory