The author and Marc Yor recently introduced a path-transformation G((k)) with the property that, for X belonging to a certain class of random walks on Z(+)(k), the transformed walk G((k))( X) has the same law as the original walk conditioned never to exit the Weyl chamber {x : x(1) less than or equal to...less than or equal to x(k)}. In this paper, we show that G((k)) is closely related to the Robinson-Schensted algorithm, and use this connection to give a new proof of the above representation theorem. The new proof is valid for a larger class of random walks and yields additional information about the joint law of X and G((k))( X). The corresponding results for the Brownian model are recovered by Donsker's theorem. These are connected with Hermitian Brownian motion and the Gaussian Unitary Ensemble of random matrix theory. The connection we make between the path-transformation G((k)) and the Robinson-Schensted algorithm also provides a new formula and interpretation for the latter. This can be used to study properties of the Robinson-Schensted algorithm and, moreover, extends easily to a continuous setting.