QuickHull and divide and conquer algorithm

In one place there is a treasure with diamonds. To get someone to treasure should avoid an area withmines. We want to find, from the starting point, the shortest path to reach the treasure and does not pass through the minefield. However, it may go scratch the minefield, practically on the mines around the minefield.   The input will be a file in the following form (without the comments): Integer coordinates exept the third line that is a single integer representing the number of diamonds. 8 23 //starting point 130 28//coordinates of the treasure 156 // the number of the diamonds 23 108 // the 1st mine 50 99 // 2nd mine 108 107 // 3rd mine 52 54 115 107 … Write a code such that:     Finding the shortest path from the initial point and print the following message. The shortest distance is 122.16872656315464 The shortest path is:(8.0,23.0) --(56.0,23.0) -- (130.0,28.0) Among the diamonds there is one fake that weighs less than the others (all the other diamonds have exactly the same weight). We have at our disposal a weighing scale (like the one in the image)   Write code that calculates the minimum number of weightings, in order to find the fake diamond. It must print the following message.   Number of weightings: 5 Instructions Write code in Java 1.7 or 1.8. The only input argument must be the input file. If you use any free code from the internet it should be noted specific. The complexity of a) in the Middle Case it must be O(n logn) and the complexity of b) must be O(n). The source code must have inline comments and extended javadoc comments over every method. You should explain the reasoning of each step and make analysis of complexity. The weighing scale can be simulated with the following   int scale() {         Random randomGenerator = new Random();         int x = randomGenerator.nextInt(100);         if (x < 34) {             return 1; // to the left         } else if (x < 67) {             return 0; //equal         } else {             return -1; // to the right         }     }
Powered by