Create a temp array to hold visited flag of all elements . Note that , calloc is used here so that all values are initialized as false
boolean visited [ ] = new boolean [ n ] ; int i ; for ( i = 0 ; i < n ; i ++ ) {