Cody

# Problem 109. Check if sorted

Solution 722191

Submitted on 25 Aug 2015 by Joseph Laub
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
%% x = sort(rand(1,10^5)); y_correct = 1; assert(isequal(sortok(x),y_correct))

s = Columns 1 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 Columns 19 through 36 0.0001 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0004 0.0004 Columns 37 through 54 0.0004 0.0004 0.0004 0.0004 0.0004 0.0004 0.0004 0.0004 0.0004 0.0004 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 Columns 55 through 72 0.0005 0.0005 0.0006 0.0006 0.0006 0.0006 0.0006 0.0006 0.0006 0.0006 0.0006 0.0006 0.0006 0.0006 0.0006 0.0006 0.0006 0.0007 Columns 73 through 90 0.0007 0.0007 0.0007 0.0007 0.0007 0.0007 0.0007 0.0007 0.0007 0.0007 0.0007 0.0007 0.0007 0.0007 0.0007 0.0007 0.0008 0.0008 Columns 91 through 108 0.0008 0.0008 0.0008 0.0008 0.0008 0.0008 0.0008 0.0008 0.0008 0.0008 0.0008 0.0009 0.0009 0.0009 0.0009 0.0010 0.0010 0.0010 Columns 109 through 126 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 Columns 127 through 144 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0012 0.0012 0.0012 0.0012 0.0012 0.0012 0.0012 Columns 145 through 162 0.0012 0.0012 0.0012 0.0012 0.0012 0.0012 0.0013 0.0013 0.0013 0.0013 0.0013 0.0013 0.0013 0.0013 0.0013 0.0013 0.0013 0.0014 Columns 163 through 180 0.0014 0.0014 0.0014 0.0014 0.0014 0.0014 0.0014 0.0014 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 0.0016 0.0016 Columns 181 through 198 0.0016 0.0016 0.0016 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0018 0.0018 0.0018 0.0018 0.0018 0.0018 Columns 199 through 216 0.0018 0.0019 0.0019 0.0019 0.0019 0.0019 0.0020 0.0020 0.0020 0.0020 0.0020 0.0020 0.0020 0.0020 0.0020 0.0020 0.0020 0.0020 Columns 217 through 234 0.0020 0.0021 0.0021 0.0021 0.0021 0.0021 0.0021 0.0021 0.0021 0.0021 0.0021 0.0021 0.0021 0.0022 0.0022 0.0022 0.0022 0.0022 Columns 235 through 252 0.0022 0.0022 0.0022 0.0022 0.0022 0.0022 0.0023 0.0023 0.0023 0.0023 0.0023 0.0023 0.0023 0.0023 0.0024 0.0024 0.0024 0.0024 Columns 253 through 270 0.0024 0.0024 0.0025 0.0025 0.0025 0.0025 0.0025 0.0025 0.0025 0.0025 0.0025 0.0026 0.0026 0.0026 0.0026 0.0026 0.0026 0.0026 Columns 271 through 288 0.0026 0.0026 0.0026 0.0026 0.0027 0.0027 0.0027 0.0027 0.0027 0.0027 0.0027 0.0028 0.0028 0.0028 0.0028 0.0028 0.0028 0.0028 Columns 289 through 306 0.0028 0.0028 0.0028 0.0029 0.0029 0.0029 0.0029 0.0029 0.0029 0.0029 0.0029 0.0029 0.0029 0.0030 0.0030 0.0030 0.0030 0.0030 Columns 307 through 324 0.0030 0.0030 0.0030 0.0031 0.0031 0.0031 0.0031 0.0031 0.0031 0.0031 0.0031 0.0031 0.0031 0.0031 0.0032 0.0032 0.0032 0.0032 Columns 325 through 342 0.0032 0.0032 0.0033 0.0033 0.0033 0.0033 0.0033 0.0033 0.0033 0.0033 0.0033 0.0034 0.0034 0.0034 0.0034 0.0034 0.0034 0.0034 Columns 343 through 360 0.0034 0.0034 0.0034 0.0034 0.0034 0.0035 0.0035 0.0035 0.0035 0.0035 0.0035 0.0035 0.0035 0.0035 0.0036 0.0036 0.0036 0.0036 Columns 361 through 378 0.0036 0.0036 0.0036 0.0036 0.0036 0.0037 0.0037 0.0037 0.0037 0.0037 0.0038 0.0038 0.0038 0.0038 0.0038 0.0038 0.0038 0.0038 Columns 379 through 396 0.0038 0.0038 0.0039 0.0039 0.0039 0.0039 0.0039 0.0039 0.0039 0.0039 0.0039 0.0039 0.0039 0.0039 0.0040 0.0040 0.0040 0.0040 Columns 397 through 414 0.0040 0.0040 0.0041 0.0041 0.0041 0.0041 0.0041 0.0041 0.0041 0.0041 0.0041 0.0041 0.0042 0.0042 0.0042 0.0042 0.0042 0.0042 Columns 415 through 432 0.0042 0.0042 0.0043 0.0043 0.0043 0.0043 0.0043 0.0043 0.0043 0.0043 0.0043 0.0043 0.0043 0.0043 0.0043 0.0043 0.0043 0.0044 Columns 433 through 450 0.0044 0.0044 0.0044 0.0044 0.0044 0.0044 0.0044 0.0045 0.0045 0.0045 0.0045 0.0046 0.0046 0.0046 0.0046 0.0046 0.0046 0.0046 Columns 451 through 468 0.0046 0.0046 0.0046 0.0046 0.0047 0.0047 0.0047 0.0047 0.0047 0.0047 0.0047 0.0047 0.0047 0.0047 0.0047 0.0047 0.0048 0.0048 Columns 469 through 486 0.0048 0.0048 0.0048 0.0048 0.0049 0.0049 0.0049 0.0049 0.0049 0.0049 0.0049 0.0049 0.0049 0.0049 0.0050 0.0050 0.0050 0.0050 Columns 487 through 504 0.0050 0.0050 0.0050 0.0050 0.0050 0.0050 0.0051 0.0051 0.0051 0.0051 0.0051 0.0051 0.0051 0.0051 0.0051 0.0052 0.0052 0.0052 Columns 505 through 522 0.0052 0.0052 0.0052 0.0052 0.0052 0.0052 0.0052 0.0053 0.0053 0.0053 0.0053 0.0053 0.0053 0.0053 0.0053 0.0053 0.0054 0.0054 Columns 523 through 540 0.0054 0.0054 0.0054 0.0054 0.0054 0.0054 0.0054 0.0054 0.0054 0.0054 0.0054 0.0054 0.0054 0.0054 0.0055 0.0055 0.0055 0.0055 Columns 541 through 558 0.0055 0.0055 0.0055 0.0055 0.0056 0.0056 0.0056 0.0056 0.0056 0.0056 0.0056 0.0056 0.0056 0.0056 0.0056 0.0056 0.0057 0.0057 Columns 559 through 576 0.0057 0.0057 0.0057 0.0057 0.0057 0.0057 0.0057 0.0057 0.0057 0.0057 0.0058 0.0058 0.0058 0.0058 0.0058 0.0058 0.0058 0.0058 Columns 577 through 594 0.0058 0.0058 0.0058 0.0058 0.0058 0.0059 0.0059 0.0059 0.0059 0.0059 0.0060 0.0060 0.0060 0.0060 0.0060 0.0060 0.0060 0.0061 Columns 595 through 612 0.0061 0.0061 0.0061 0.0061 0.0061 0.0062 0.0062 0.0062 0.0062 0.0063 0.0063 0.0063 0.0063 0.0063 0.0063 0.0063 0.0063 0.0064 Columns 613 through 630 0.0064 0.0064 0.0064 0.0064 0.0064 0.0064 0.0064 0.0064 0.0064 0.0064 0.0064 0.0064 0.0064 0.0064 0.0064 0.0064 0.0064 0.0065 Columns 631 through 648 0.0065 0.0065 0.0065 0.0065 0.0065 0.0066 0.0066 0.0066 0.0066 0.0066 0.0066 0.0067 0.0067 0.0067 0.0067 0.0067 0.0067 0.0067 Columns 649 through 666 0.0067 0.0067 0.0067 0.0068 0.0068 0.0068 0.0068 0.0068 0.0068 0.0068 0.0068 0.0068 0.0068 0.0068 0.0068 0.0068 0.0068 0.0068 Columns 667 through 684 0.0069 0.0069 0.0069 0.0069 0.0069 0.0070 0.0070 0.0070 0.0070 0.0070 0.0070 0.0070 0.0070 0.0070 0.0070 0.0070 0.0071 0.0071 Columns 685 through 702 0.0071 0.0071 0.0071 0.0071 0.0071 0.0071 0.0071 0.0071 0.0072 0.0072 0.0072 0.0072 0.0072 0.0072 0.0072 0.0072 0.0072 0.0072 Columns 703 through 720 0.0072 0.0073 0.0073 0.0073 0.0073 0.0073 0.0073 0.0073 0.0073 0.0073 0.0074 0.0074 0.0074 0.0074 0.0074 0.0074 0.0074 0.0074 Columns 721 through 738 0.0074 0.0074 0.0074 0.0074 0.0075 0.0075 0.0075 0.0075 0.0075 0.0075 0.0075 0.0075 0.0075 0.0075 0.0075 0.0075 0.0075 0.0075 Columns 739 through 756 0.0075 0.0075 0.0076 0.0076 0.0076 0.0076 0.0076 0.0076 0.0076 0.0076 0.0076 0.0076 0.0076 0.0076 0.0077 0.0077 0.0077 0.0077 Columns 757 through 774 0.0077 0.0077 0.0077 0.0077 0.0077 0.0078 0.0078 0.0078 0.0078 0.0078 0.0078 0.0078 0.0079 0.0079 0.0079 0.0079 0.0079 0.0079 Columns 775 through 792 0.0079 0.0079 0.0079 0.0079 0.0079 0.0079 0.0079 0.0080 0.0080 0.0080 0.0080 0.0080 0.0080 0.0080 0.0080 0.0080 0.0081 0.0081 Columns 793 through 810 0.0081 0.0081 0.0081 0.0081 0.0081 0.0081 0.0081 0.0081 0.0081 0.0081 0.0082 0.0082 0.0082 0.0082 0.0082 0.0082 0.0082 0.0082 Columns 811 through 828 0.0082 0.0082 0.0082 0.0083 0.0083 0.0083 0.0083 0.0083 0.0083 0.0083 0.0083 0.0083 0.0083 0.0083 0.0084 0.0084 0.0084 0.0084 Columns 829 through 846 0.0084 0.0084 0.0084 0.0084 0.0084 0.0084 0.0084 0.0084 0.0084 0.0084 0.0084 0.0084 0.0084 0.0085 0.0085 0.0085 0.0085 0.0085 Columns 847 through 864 0.0085 0.0085 0.0085 0.0085 0.0086 0.0086 0.0086 0.0086 0.0086 0.0086 0.0086 0.0086 0.0086 0.0086 0.0086 0.0086 0.0086 0.0086 Columns 865 through 882 0.0086 0.0086 0.0086 0.0086 0...

2   Pass
%% x = [1 5 4 3 8 7 3]; y_correct = 0; assert(isequal(sortok(x),y_correct))

s = 1 3 3 4 5 7 8 y = 0