Running demo2d.js

➕︎ Aa ➖︎ |Dark 1Dark 2Light|HackFira Code|Back to  PT Mono
// CPCS 223 Analysis & Design of Algorithms
// Brute force closest pair
// 2020, Dr. Muhammad Al-Hashimi


// -----------------------------------------------------------------------
// points specified as x and y coordinate arrays
// closeset pair indices returned in cp 
// assuming viewport of 600 x 400 pixels (big enough to show)
// note we ignore index 0 to match textbook pseudocode

var x = [,523,98,174,117,179,217,285,123,51,489,489,397,384,407,225];
var y = [,380,86,109,197,207,138,240,266,162,62,247,174,189,317,325];
var cp = [];

document.write(cp);


// --------------------
// insert your code here