If only you could use get_categories()
reference in the Codex, you could see that this function supports arguments.
<?php
$categories = get_categories( array(
'orderby' => 'name', // default value, can omit it
'order' => 'DESC'
));
foreach($categories as $cat) {
// your code goes here
}