Cody

# Problem 44816. Word Distance - Average Sort

Solution 2122791

Submitted on 9 Feb 2020 by Asif Newaz
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
assert(isequal(word_distance_sort({'jazz','cab','tree'}),{'cab','tree','jazz'}))

d = 8.5000 1.0000 3.7500 i = 2 3 1

2   Pass
assert(isequal(word_distance_sort({'first','second','third'}),{'first','second','third'}))

d = 2.8000 6.5000 7.2000 i = 1 2 3

3   Pass
assert(isequal(word_distance_sort({'the','longest','words','supercede','some','of','the','shortest'}), ... {'some','longest','of','the','the','supercede','shortest','words'}))

d = 5.0000 4.0000 8.0000 5.5556 3.5000 4.5000 5.0000 6.6250 i = 5 2 6 1 7 4 8 3

4   Pass
assert(isequal(word_distance_sort({'one','TWO','Three','FouR','fiVe','six','sEvEn','EiGHt','NINe','ten'}), ... {'one','TWO','EiGHt','FouR','NINe','Three','ten','fiVe','six','sEvEn'}))

d = 3.3333 3.6667 7.0000 4.5000 8.2500 8.3333 11.4000 3.8000 4.7500 8.0000 i = 1 2 8 4 9 3 10 5 6 7

5   Pass
assert(isequal(word_distance_sort({'Why','is','it','that','this','does','not','work','as','expected'}), ... {'not','work','is','it','this','does','as','expected','that','Why'}))

d = 10.6667 5.0000 5.5000 9.5000 5.7500 8.7500 2.0000 4.5000 9.0000 9.1250 i = 7 8 2 3 5 6 9 10 4 1

6   Pass
assert(isequal(word_distance_sort({'set','of','very','short','words','for','this','test','case'}), ... {'for','of','short','this','test','words','case','very','set'}))

d = 9.6667 4.5000 9.2500 4.6000 8.0000 4.0000 5.7500 7.5000 8.5000 i = 6 2 4 7 8 5 9 3 1

7   Pass
assert(isequal(word_distance_sort({'iron','zinc','carbon','molybdenum','praseodymium','silicon'}), ... {'iron','silicon','molybdenum','carbon','zinc','praseodymium'}))

d = 3.2500 8.2500 8.1667 6.8000 10.7500 5.0000 i = 1 6 4 3 2 5

8   Pass
assert(isequal(word_distance_sort({'crazier','craziest','crazy'}), ... {'crazy','craziest','crazier'}))

d = 13.0000 11.6250 11.6000 i = 3 2 1

9   Pass
assert(isequal(word_distance_sort({'this','test','case','with','only','four','each','word'}), ... {'each','only','four','this','word','test','case','with'}))

d = 5.7500 7.5000 8.5000 9.2500 4.0000 4.5000 2.7500 6.2500 i = 7 5 6 1 8 2 3 4

10   Pass
assert(isequal(word_distance_sort({'largest','smallest','sourest','sweetest'}), ... {'sourest','smallest','largest','sweetest'}))

d = 8.0000 6.3750 5.8571 8.3750 i = 3 2 1 4