SHARE
TWEET

Untitled

a guest Apr 18th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   private int DFSrec(int startVertex,
  2.                         boolean[] visitedArr, int[] predecessorArr,
  3.                         int whiteArea, int blackArea) {
  4.  
  5.         visitedArr[startVertex] = true;
  6.         for (int neighbour : adjList.get(startVertex)) {
  7.             if ( !visitedArr[neighbour] ) {
  8.                 predecessorArr[neighbour] = startVertex;
  9.                 if (islandsList.get(startVertex).colour.equals("WHITE")) {
  10.                     whiteArea += islandsList.get(startVertex).size;
  11.                     islandsList.get(neighbour).setColour("BLACK");
  12.                 } else {
  13.                     blackArea += islandsList.get(startVertex).size;
  14.                     islandsList.get(neighbour).setColour("WHITE");
  15.                 }
  16.             }
  17.             DFSrec(neighbour, visitedArr, predecessorArr, whiteArea, blackArea);
  18.         }
  19.  
  20.         if (whiteArea <= blackArea) return whiteArea;
  21.         else return blackArea;
  22.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top