Skip to content

jonwurtzler/challenge_alpha-sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Challenge

Write a function that sorts the letters of the word typewriter alphabetically.

Installation

Install the vendor dependencies with Composer:

$ composer install

Usage

$ php alphasort.php
    Sorting String: typewriter
    
    Finished Sorting String via Dual Arrays!
    Number of Comparisons: 23
    Sorted String: eeiprrttwy
    
    Finished Sorting String via Swap Sort!
    Number of Comparisons: 34
    Sorted String: eeiprrttwy

$ php alphasort.php testing
    Sorting String: testing
    
    Finished Sorting String via Dual Arrays!
    Number of Comparisons: 13
    Sorted String: eginstt
    
    Finished Sorting String via Swap Sort!
    Number of Comparisons: 18
    Sorted String: eginstt

$ php alphasort.php somereallylongstringwithrandomcharactersattheendzeklfsaewesa
    Sorting String: somereallylongstringwithrandomcharactersattheendzeklfsaewesa
    
    Finished Sorting String via Dual Arrays!
    Number of Comparisons: 803
    Sorted String: aaaaaaaccddeeeeeeeefgghhhiikllllmmnnnnooorrrrrssssstttttwwyz
    
    Finished Sorting String via Swap Sort!
    Number of Comparisons: 976
    Sorted String: aaaaaaaccddeeeeeeeefgghhhiikllllmmnnnnooorrrrrssssstttttwwyz

About

PHP Challenge #2 - Write a function that sorts the letters of the word typewriter alphabetically.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages