# Thuật toán Algorithms (Phần 35)

Chia sẻ: Tran Anh Phuong | Ngày: | Loại File: PDF | Số trang:10

0
32
lượt xem
3

## Thuật toán Algorithms (Phần 35)

Mô tả tài liệu

Tham khảo tài liệu 'thuật toán algorithms (phần 35)', khoa học tự nhiên, toán học phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả

Chủ đề:

Bình luận(0)

Lưu

## Nội dung Text: Thuật toán Algorithms (Phần 35)

2. 26. Range Searching Given a set of points in the plane, it is natural to ask which of those points fall within some specified area. “List all cities within 50 miles of Providence” is a question of this type which could reasonably be asked if a set of points corresponding to the cities of the U.S. were available. When the geometric shape is restricted to be a rectangle, the issue readily extends to non-geometric problems. For example, “list all those people between 21 and 25 with incomes between $60,000 and$100,000” asks which “points” from a file of data on people’s names, ages, and incomes fall within a certain rectangle in the age-income plane. Extension to more than two dimensions is immediate. If we want to list all stars within 50 light years of the sun, we have a three-dimensional problem, and if we want the rich young people of the second example in the paragraph above to be tall and female as well, we have a four-dimensional problem. In fact, the dimension can get very high for such problems. In general, we assume that we have a set of records with certain at- tributes that take on values from some ordered set. (This is sometimes called a database, though more precise and complete definitions have been developed for this important term.) The problem of finding all records in a database which satisfy specified range restrictions on a specified set of attributes is called range searching. For practical applications, this is a difficult and im- portant problem. In this chapter, we’ll concentrate on the two-dimensional geometric problem in which records are points and attributes are their coor- dinates, then we’ll discuss appropriate generalizations. The methods that we’ll look at are direct generalizations of methods that we have seen for searching on single keys (in one dimension). We presume that many queries will be made on the same set of points, so the problem splits into two parts: we need a preprocessing algorithm, which builds the given points into a structure supporting efficient range searching, and a range-searching 335