| 
 | 1 | +# Exercise: Selection Sort  | 
 | 2 | + | 
 | 3 | +Implement a Multi-Level Sort of a given list of dictionaries based on a given sorting order. If user wants to sort dictionary based on First Key 'A', Then Key 'B', they shall pass list of keys in the order of  preference as a list ['A','B']. Your code should be able to sort list of dictionaries for any number of keys in sorting order list.  | 
 | 4 | + | 
 | 5 | +Using this multi-level sort, you should be able to sort any list of dictionaries based on sorting order preference  | 
 | 6 | + | 
 | 7 | +Example:  | 
 | 8 | +A single dictionary entry contains two keys 'First Name' and 'Last Name'. the list should be sorted first based on 'First Name', then based on 'Last Name', w.r.t. common/same 'First Name' entries.  | 
 | 9 | + | 
 | 10 | +for this, one shall past sorting order of preference list [ 'First Name' , 'Last Name' ]  | 
 | 11 | + | 
 | 12 | +For this, Given the following sequence List:  | 
 | 13 | +   | 
 | 14 | +```  | 
 | 15 | +[  | 
 | 16 | +    {'First Name': 'Raj', 'Last Name': 'Nayyar'},  | 
 | 17 | +    {'First Name': 'Suraj', 'Last Name': 'Sharma'},  | 
 | 18 | +    {'First Name': 'Karan', 'Last Name': 'Kumar'},  | 
 | 19 | +    {'First Name': 'Jade', 'Last Name': 'Canary'},  | 
 | 20 | +    {'First Name': 'Raj', 'Last Name': 'Thakur'},  | 
 | 21 | +    {'First Name': 'Raj', 'Last Name': 'Sharma'},  | 
 | 22 | +    {'First Name': 'Kiran', 'Last Name': 'Kamla'},  | 
 | 23 | +    {'First Name': 'Armaan', 'Last Name': 'Kumar'},  | 
 | 24 | +    {'First Name': 'Jaya', 'Last Name': 'Sharma'},  | 
 | 25 | +    {'First Name': 'Ingrid', 'Last Name': 'Galore'},  | 
 | 26 | +    {'First Name': 'Jaya', 'Last Name': 'Seth'},  | 
 | 27 | +    {'First Name': 'Armaan', 'Last Name': 'Dadra'},  | 
 | 28 | +    {'First Name': 'Ingrid', 'Last Name': 'Maverick'},  | 
 | 29 | +    {'First Name': 'Aahana', 'Last Name': 'Arora'}  | 
 | 30 | +]  | 
 | 31 | +```  | 
 | 32 | + | 
 | 33 | + | 
 | 34 | +Your algorithm should generate sorted list:  | 
 | 35 | + | 
 | 36 | +```  | 
 | 37 | +[  | 
 | 38 | +    {'First Name': 'Aahana', 'Last Name': 'Arora'}  | 
 | 39 | +    {'First Name': 'Armaan', 'Last Name': 'Dadra'}  | 
 | 40 | +    {'First Name': 'Armaan', 'Last Name': 'Kumar'}  | 
 | 41 | +    {'First Name': 'Ingrid', 'Last Name': 'Galore'}  | 
 | 42 | +    {'First Name': 'Ingrid', 'Last Name': 'Maverick'}  | 
 | 43 | +    {'First Name': 'Jade', 'Last Name': 'Canary'}  | 
 | 44 | +    {'First Name': 'Jaya', 'Last Name': 'Seth'}  | 
 | 45 | +    {'First Name': 'Jaya', 'Last Name': 'Sharma'}  | 
 | 46 | +    {'First Name': 'Karan', 'Last Name': 'Kumar'}  | 
 | 47 | +    {'First Name': 'Kiran', 'Last Name': 'Kamla'}  | 
 | 48 | +    {'First Name': 'Raj', 'Last Name': 'Nayyar'}  | 
 | 49 | +    {'First Name': 'Raj', 'Last Name': 'Sharma'}  | 
 | 50 | +    {'First Name': 'Raj', 'Last Name': 'Thakur'}  | 
 | 51 | +    {'First Name': 'Suraj', 'Last Name': 'Sharma'}  | 
 | 52 | +]  | 
 | 53 | +```  | 
 | 54 | + | 
 | 55 | + | 
 | 56 | + | 
 | 57 | + | 
 | 58 | + | 
 | 59 | + [Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/algorithms/7_SelectionSort/selection_sort_exercise_solution.py)  | 
0 commit comments