// Source code example for "A Practical Introduction // to Data Structures and Algorithm Analysis" // by Clifford A. Shaffer, Prentice Hall, 1998. // Copyright 1998 by Clifford A. Shaffer import java.io.*; // K-D tree driver class public class KDmain { // Make a k-d tree and insert/search for some things public static void main(String args[]) throws IOException { KDtree dum = new KDtree(2); int[] p1 = {30, 34}; int[] p2 = {30, 35}; int[] s1 = {20, 20}; dum.insert(new DElem(10, 10)); dum.insert(new DElem(5, 30)); dum.insert(new DElem(30, 34)); dum.insert(new DElem(5, 5)); dum.print(); dum.regionSearch(s1, 20); if(dum.find(p1) != null) System.out.println("Found 30, 34"); if (dum.find(p2) != null) System.out.println("Found 30, 35"); System.in.read(); } }