Skip to main content

QuickHull and divide and conquer algorithm

Requirements:

In one place there is a treasure with diamonds. To get someone to treasure should avoid an area with
mines. 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:


  1. 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)
  2. 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
        }
    }


CONTACT DETAILS

For any other questions or other tasks please feel free to contact me
via email: mhassnainjamil@gmail.com
via WhatsApp: +92-324-7042178
via skype: hassnainjamil1

Comments

Popular posts from this blog

The Zoo Management System - entity relationship diagram & MS Access Database

Zoo Management System - Project Details: You are the employee of a big, worldwide working Zoo Management Company. Your company is responsible for the Zoo management. Your boss thinks it would be a great idea to store all data for each Zoo in a brand new self-developed ZOO Management System. Up to now, the ZOO management company has maps of each ZOO available. Your boss knows that you took a course in introduction on an ERP system, so he asks you if you could help designing such a system. Each ZOO must have the same organizational structure, which should look like this: Each Zoo has a Zoo-Address. Each Zoo has many visitors (Visitor Ticket Process (VTP). Many Zoo-Attractions belong to a Zoo. Module 1: Entity Relationship Diagram Design a ER (entity-relationship) diagram for your ZOO Management System. Use the information provided below with the entities and its attributes. Put the entities in the correct relationship to each other (organizational structure). Module 2: DB Implem...

EIT Knowledge and Innovative Community Scholarships has been announced

Admission Criteria To qualify for our programmes, applicants need to fulfill the admission requirements based on previous studies, English proficiency and relevant documentation. Previous Studies: A Completed Bachelor’s Degree In order to be admitted into a KIC InnoEnergy MSc programme, you must have completed a Bachelor’s degree encompassing a minimum of 180 ECTS credits or equivalent academic qualifications from an internationally recognized university. Please note that admissions depend on the specific BSc degree you hold for entry into the MSc programme you are interested in. Conditional Acceptance – Undergraduate Students in Final Year Students in their final year of undergraduate education may also apply and if expected to qualify, receive a conditional offer. If you have not completed your studies, please include a written statement from your university’s administration office (or equivalent department), confirming that you are enrolled in the final year of your study programme ...

Human Physiology by Stuart Ira Fox [PDF] (12th edition) free download