in Combinatory edited by
252 views
2 votes
2 votes

It can be shown that Cn, the average number of comparisons made by the quick sort algorithm (described in preamble to question $50$ in exercise $5.4),$ when sorting $n$ elements in random order, satisfies the recurrence relation

$$C_{n} = 1 + n + \dfrac{2}{n}\sum_{k=0}^{n-1}C_{k}$$
for $n = 1, 2, \dots,$ with initial condition $C_{0} = 0.$

  1. Show that $\{C_{n}\}$ also satisfies the recurrence relation $nC_{n} = (n + 1)C_{n-1} + 2n \:\text{for}\: n = 1, 2, \dots$
  2. Use question $48$ to solve the recurrence relation in part $(A)$ to find an explicit formula for $C_{n}.$
in Combinatory edited by
by
252 views

Please log in or register to answer this question.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true