Traditionally, a fundamental assumption in evaluating the performance of algorithms for sorting and selection has been that comparing any two elements costs one unit (of time, work, etc.); the goal of an algorithm is to minimize the total cost incurred. However, a body of recent work has attempted to find ways to weaken this assumption – in particular, new algorithms have been given for these basic problems of searching, sorting and selection, when comparisons between different pairs of elements have different associated costs.

In this paper, we further these investigations, and address the questions of max-finding and sorting when the comparison costs form a metric; i.e., the comparison costs c uv respect the triangle inequality c uv + c vw c uw for all input elements u,v and w. We give the first results for these problems – specifically, we present

  • An O(log n)-competitive algorithm for max-finding on general metrics, and we improve on this result to obtain an O(1)-competitive algorithm for the max-finding problem in constant dimensional spaces.

  • An O(log2 n)-competitive algorithm for sorting in general metric spaces.

Our main technique for max-finding is to run two copies of a simple natural online algorithm (that costs too much when run by itself) in parallel. By judiciously exchanging information between the two copies, we can bound the cost incurred by the algorithm; we believe that this technique may have other applications to online algorithms.


Triangle Inequality Maximum Element Competitive Ratio Online Algorithm Comparison Cost 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Knuth, D.E.: The art of computer programming. Sorting and searching, vol. 3. Addison- Wesley Publishing Co., Reading (1973)Google Scholar
  2. 2.
    Charikar, M., Fagin, R., Guruswami, V., Kleinberg, J., Raghavan, P., Sahai, A.: Query strategies for priced information. In: Proc. 32nd ACM STOC, pp. 582–591 (2000)Google Scholar
  3. 3.
    Gupta, A., Kumar, A.: Sorting and selection with structured costs. In: Proc. 42nd IEEE FOCS, pp. 416–425 (2001)Google Scholar
  4. 4.
    Kannan, S., Khanna, S.: Selection with monotone comparison costs. In: Proc. 14th ACM SIAM SODA, pp. 10–17 (2003)Google Scholar
  5. 5.
    Bartal, Y.: Probabilistic approximations of metric spaces and its algorithmic applications. In: Proc. 37th IEEE FOCS, pp. 184–193 (1996)Google Scholar
  6. 6.
    Fakcharoenphol, J., Rao, S., Talwar, K.: A tight bound on approximating arbitrary metrics by tree metrics. In: Proc. 35th ACM STOC, pp. 448–455 (2003)Google Scholar
  7. 7.
    Hartline, J., Hong, E., Mohr, A., Rocke, E., Yasuhara, K.: As reported in [3]Google Scholar
  8. 8.
    Kleinberg, J.: Detecting a network failure. Internet Math 1, 37–55 (2003)zbMATHMathSciNetCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Anupam Gupta
    • 1
  • Amit Kumar
    • 2
  1. 1.Dept. of Computer ScienceCarnegie Mellon UniversityPittsburghUSA
  2. 2.Dept. of Computer Science & EngineeringIndian Institute of TechnologyHauz Khas, New DelhiIndia

Personalised recommendations