Find the number of functions $ A\stackrel{f}{\longrightarrow } A $ for which there exist two functions $ A\stackrel{g}{\longrightarrow } B\stackrel{h}{\longrightarrow } A $ having the properties that $ g\circ h =\text{id.} $ and $ h\circ g=f, $ where $ B $ and $ A $ are two finite sets.
1. Let \( A \) be a finite set with \( |A| = n \) and \( B \) be a finite set with \( |B| = k \). We are given that there exist functions \( g: A \to B \) and \( h: B \to A \) such that \( g \circ h = \text{id}_B \) and \( h \circ g = f \).

2. The condition \( g \circ h = \text{id}_B \) implies that \( h \) is an injective function (one-to-one) from \( B \) to \( A \) and \( g \) is a surjective function (onto) from \( A \) to \( B \). This means that \( B \) is isomorphic to a subset \( A' \subseteq A \) with \( |A'| = k \).

3. The condition \( h \circ g = f \) implies that \( f \) maps elements of \( A \) to elements of \( A \) such that \( f \) is the identity on the subset \( A' \) (i.e., \( f(a) = a \) for all \( a \in A' \)) and can be any function on the remaining elements of \( A \setminus A' \).

4. To count the number of such functions \( f \), we first choose the subset \( A' \subseteq A \) with \( |A'| = k \). The number of ways to choose \( A' \) is given by the binomial coefficient:
   \[
   \binom{n}{k}
   \]

5. Once \( A' \) is chosen, \( f \) must be the identity on \( A' \). For the remaining \( n - k \) elements in \( A \setminus A' \), \( f \) can map each of these elements to any of the \( n \) elements in \( A \). Therefore, there are \( n^{n-k} \) ways to define \( f \) on \( A \setminus A' \).

6. Combining these, the total number of functions \( f \) is:
   \[
   \binom{n}{k} \cdot n^{n-k}
   \]

The final answer is \( \boxed{\binom{n}{k} \cdot n^{n-k}} \).