Skip to content

Commit 0f7d398

Browse files
committed
Adjust O(n*logn) formatting.
1 parent f136c65 commit 0f7d398

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

chapters/03_algorithms_03_sorting.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ \subsection{\texorpdfstring{\cpp{std::lexicographical_compare_three_way}}{\textt
7979
\subsection{\texorpdfstring{\cpp{std::sort}}{\texttt{std::sort}}}
8080
\index{\cpp{std::sort}}
8181

82-
The \cpp{std::sort} algorithm is the canonical $O(n*logn)$ sort (typically implemented as intro-sort).
82+
The \cpp{std::sort} algorithm is the canonical $O(n\log n)$ sort (typically implemented as intro-sort).
8383

8484
\cppversions{\texttt{sort}}{\CC98}{\CC20}{\CC17}{\CC20}
8585
\constraints{\cpp{random_access_range}}{\cpp{random_access_range}}{\cpp{operator<}}{\cpp{strict_weak_ordering}}
8686

87-
Due to the $O(n*logn)$ complexity guarantee, \cpp{std::sort} only operates on \cpp{random_access} ranges. Notably, \cpp{std::list} offers a method with an approximate $n*logn$ complexity.
87+
Due to the $O(n\log n)$ complexity guarantee, \cpp{std::sort} only operates on \cpp{random_access} ranges. Notably, \cpp{std::list} offers a method with an approximate $n\log n$ complexity.
8888

8989
\begin{codebox}[]{\href{https://compiler-explorer.com/z/vef61TWj9}{\ExternalLink}}
9090
\footnotesize Basic example of using \cpp{std::sort} and \cpp{std::list::sort}.
@@ -110,7 +110,7 @@ \subsection{\texorpdfstring{\cpp{std::stable_sort}}{\texttt{std::stable\_sort}}}
110110
\cppversions{\texttt{stable\_sort}}{\CC98}{N/A}{\CC17}{\CC20}
111111
\constraints{\cpp{random_access_range}}{}{\cpp{operator<}}{\cpp{strict_weak_ordering}}
112112

113-
If additional memory is available, stable\_sort remains $O(n*logn)$. However, if it fails to allocate, it will degrade to an $O(n*logn*logn)$ algorithm.
113+
If additional memory is available, stable\_sort remains $O(n\log n)$. However, if it fails to allocate, it will degrade to an $O(n\log n\log n)$ algorithm.
114114

115115
\begin{codebox}[]{\href{https://compiler-explorer.com/z/TKx8qP8bK}{\ExternalLink}}
116116
\footnotesize Example of re-sorting a range using \cpp{std::stable_sort}, resulting in a guaranteed order of elements.

chapters/03_algorithms_05_divide.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ \subsection{\texorpdfstring{\cpp{std::lower_bound}, \cpp{std::upper_bound}}{\tex
3030
\cppfile{code_examples/algorithms/lower_bound_code.h}
3131
\end{codebox}
3232

33-
While the algorithms will operate on any \cpp{forward_range}, the logarithmic divide and conquer behaviour is only available for \cpp{random_access_range}. Data structures like \cpp{std::set}, \cpp{std::multiset}, \cpp{std::map} and \cpp{std::multimap} offer their $O(logn)$ implementations of lower and upper bound as methods.
33+
While the algorithms will operate on any \cpp{forward_range}, the logarithmic divide and conquer behaviour is only available for \cpp{random_access_range}. Data structures like \cpp{std::set}, \cpp{std::multiset}, \cpp{std::map} and \cpp{std::multimap} offer their $O(\log n)$ implementations of lower and upper bound as methods.
3434

3535
\begin{codebox}[]{\href{https://compiler-explorer.com/z/o9Wdvzno9}{\ExternalLink}}
3636
\footnotesize Example of using \cpp{lower_bound} and \cpp{upper_bound} methods on a \cpp{std::multiset}.

chapters/03_algorithms_15_heap.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ \subsection{\texorpdfstring{\cpp{std::make_heap}, \cpp{std::push_heap}, \cpp{std
3939
\subsection{\texorpdfstring{\cpp{std::sort_heap}}{\texttt{std::sort\_heap}}}
4040
\index{\cpp{std::sort_heap}}
4141

42-
The \cpp{std::sort_heap} will reorder the elements in a heap into a sorted order. Note that this is the same as repeatedly calling \cpp{std::pop_heap}; hence the algorithm has $O(n*logn)$ complexity.
42+
The \cpp{std::sort_heap} will reorder the elements in a heap into a sorted order. Note that this is the same as repeatedly calling \cpp{std::pop_heap}; hence the algorithm has $O(n\log n)$ complexity.
4343

4444
\cppversions{\texttt{sort\_heap}}{\CC98}{\CC20}{N/A}{\CC20}
4545
\constraints{\texttt{random\_access\_range}}{}{\texttt{operator<}}{\texttt{strict\_weak\_ordering}}

0 commit comments

Comments
 (0)