Lecture overview -- Keyboard shortcut: 'u'  Previous page: Documentation of the algorithms library -- Keyboard shortcut: 'p'  Next page: Principles used for algorithms -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 5 - Page 32 : 39
Notes about C++
Templates and The Standard Library
Overview of Algorithms

The standard library contains approximately 60 standard algorithms

Most of these represent simple ideas, as opposed to algorithms in an Algorithms and Data Structure course tradition

The design here is not on the desing of algorithms or even on the use of any but the simplest and most obvious algorithms, §18.2 in The C++ Programming Language

  • The C++ Programming Language: Page 508
 

  • Nonmodifying sequence algorithms

    • for-each(): Applies a function on each element of a sequence

    • find(): Find the first element that satisfies a given predicate. Return iterator to element

  • Modifying sequence algorithms

    • transform(): Applies a function on each element, and writes the result into another container.

    • replace(): Replace elements that satisfies a predicate with a another value

  • Sorted sequence algorithms

    • sort

    • binary_search

  • Set algorithms

    • Heap algorithms

      • make_heap, push_heap, and pop_heap

    • Min and max algorithms

      • The naive min and max functions

      • max_element and min_element: Generalization to sequences of elements

    • Permutation algorithms

      • next_permuation and prev_permuation: Systematic creation of permutations of a sequence

    • Numeric algorithms