{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

RangeSearch2D - height method will be used to check...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * TITLE: COMP202 PA4 * * @(#)RangeQuery2D 2009/04/10 * @author Attila Gursoy * * Copyright (c) 2009 Attila Gursoy * All Rights Reserved. */ package pa4; import java.util.List; // RangeSeacrh2D is an abstract data type that supports insertion, and range search operations // on two dimensional data (a pair). public interface RangeSearch2D<X extends Comparable<? super X>, Y extends Comparable<? super Y>> { // return true if empty boolean isEmpty(); // insert Pair<X,Y> p // return true if insertion is successful // return false in case of duplicate insertion boolean insert(Pair<X,Y> p); // return the number of pairs (element) int size(); // return the size of the tree data structure used to implement this interface
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // height method will be used to check correctness of yoru implementation. // it is not valid for linked list example. int height(); // return list of data (pair) within rectangle specified by lowerleft and upperright List<Pair<X,Y>> getRange(Pair<X,Y> lowerleft, Pair<X,Y> upperright); // return true if p is in the collection boolean contains(Pair<X,Y> p); // create a pair Pair<X,Y> makePair(X x, Y y); // a pair is a two dimensional data. Any inmplementation of pair must provide // two public methods which returns first element and second element in the pair public interface Pair<X,Y> { X getX(); Y getY(); } }...
View Full Document

{[ snackBarMessage ]}