Skip to main content Accessibility help
×
Hostname: page-component-848d4c4894-xm8r8 Total loading time: 0 Render date: 2024-07-03T09:19:28.575Z Has data issue: false hasContentIssue false

6 - Balanced Trees

Published online by Cambridge University Press:  05 June 2012

Guy Cousineau
Affiliation:
Ecole Normale Supérieure, Paris
Michel Mauny
Affiliation:
Institut National de Recherche en Informatique et en Automatique (INRIA), Rocquencourt
Get access

Summary

This chapter defines a group of functions to manage large-scale data sets. These functions use trees as data structures because they are so well adapted to representing data sets that evolve dynamically, that is, data sets where the size can grow or shrink during computations.

The specific data structure we use is a binary tree. The algorithms we propose make it possible to keep these binary trees balanced, and this property ensures the efficiency of operations we want to carry out.

The main operations for managing a data set are these:

  • searching for an element in the data set;

  • adding an element to the data set;

  • removing an element from the data set.

To search naively for an element in a data set, we can simply sweep sequentially through all the elements of the set, but that takes time proportional to the size of the data set. Its complexity is thus O(n). This technique is the only one we can use when we are managing data sets generically because we do not know any particular properties of the set.

In order to search more efficiently, we have to make hypotheses about the structure of the data set under consideration. For example, if we can assume that the data are ordered, then we can use a binary search as we did in Section 4.4.1 to represent sets by sorted arrays.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 1998

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Balanced Trees
  • Guy Cousineau, Ecole Normale Supérieure, Paris, Michel Mauny, Institut National de Recherche en Informatique et en Automatique (INRIA), Rocquencourt
  • Translated by K. Callaway
  • Book: The Functional Approach to Programming
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9781139173018.010
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Balanced Trees
  • Guy Cousineau, Ecole Normale Supérieure, Paris, Michel Mauny, Institut National de Recherche en Informatique et en Automatique (INRIA), Rocquencourt
  • Translated by K. Callaway
  • Book: The Functional Approach to Programming
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9781139173018.010
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Balanced Trees
  • Guy Cousineau, Ecole Normale Supérieure, Paris, Michel Mauny, Institut National de Recherche en Informatique et en Automatique (INRIA), Rocquencourt
  • Translated by K. Callaway
  • Book: The Functional Approach to Programming
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9781139173018.010
Available formats
×