TITLE: Bijection between Dyck paths with $k$ peaks and $n+1-k$ peaks
QUESTION [6 upvotes]: A Dyck path of order $n$ can be thought of as a sequence of $n$ $0$'s and $n$ $1$'s such that in any initial segment, the $1$'s do not outnumber the $0$'s. A peak is a $0$ which is immediately followed by a $1$. It can be shown that the number of Dyck paths of order $n$ with exactly $k$ peaks is counted by the Narayana numbers,
$$
N(n,k) = \frac1n\binom{n}k\binom{n}{k-1}.
$$
Using the above formula, it is easy to show that the Narayana numbers are symmetric in $k$, in the sense that $N(n,k)=N(n,n+1-k)$. However, the corresponding symmetry between Dyck paths with $k$ peaks and Dyck paths with $n+1-k$ peaks is not so clear (to me).

What is a bijection between Dyck paths of order $n$ with $k$ peaks and Dyck paths of order $n$ with $n+1-k$ peaks?

REPLY [2 votes]: There is a nice bijection between Dyck paths of order $n$ and planar binary trees. The bijection $\phi$ can be described recursively. Every Dyck path $D$ of order $n$ can be uniquely decomposed as $(0,D',1,D'')$, where $D'$ and $D''$ are smaller (possible empty) Dyck paths. Explicitly, the "$1$" in that formula is the end of the shortest, nonempty prefix with an equal number of $0$'s and $1$'s. Then $\phi(D)$ is defined to be the planar binary tree whose left subtree of the root is $\phi(D')$ and whose right subtree is $\phi(D'')$. 
Under this bijection, peaks in the original path correspond to left children in the resulting tree. There is an obvious involution on planar binary trees with reverses left and right children; just reflect the tree vertically! Composing this with the bijection in the last paragraph, you get an involution on Dyck paths which takes a path with $k$ peaks to one with $n+1-k$ peaks.