Cody

Problem 109. Check if sorted

Solution 901523

Submitted on 3 Jun 2016 by Adithyan Sujithkumar
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))

A = Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 0.0001 0.0001 Columns 10 through 18 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 Columns 19 through 27 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0002 0.0002 0.0002 Columns 28 through 36 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 0.0002 Columns 37 through 45 0.0002 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 Columns 46 through 54 0.0003 0.0004 0.0004 0.0004 0.0004 0.0004 0.0004 0.0004 0.0004 Columns 55 through 63 0.0004 0.0004 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 Columns 64 through 72 0.0005 0.0005 0.0005 0.0006 0.0006 0.0006 0.0006 0.0006 0.0006 Columns 73 through 81 0.0006 0.0006 0.0006 0.0007 0.0007 0.0007 0.0007 0.0007 0.0007 Columns 82 through 90 0.0007 0.0007 0.0007 0.0008 0.0008 0.0008 0.0008 0.0009 0.0009 Columns 91 through 99 0.0009 0.0009 0.0009 0.0009 0.0009 0.0009 0.0010 0.0010 0.0010 Columns 100 through 108 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0011 0.0011 Columns 109 through 117 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0012 0.0012 Columns 118 through 126 0.0012 0.0012 0.0012 0.0012 0.0012 0.0012 0.0012 0.0012 0.0013 Columns 127 through 135 0.0013 0.0013 0.0013 0.0013 0.0013 0.0013 0.0013 0.0013 0.0013 Columns 136 through 144 0.0013 0.0014 0.0014 0.0014 0.0014 0.0014 0.0014 0.0014 0.0014 Columns 145 through 153 0.0014 0.0014 0.0014 0.0015 0.0015 0.0015 0.0015 0.0015 0.0015 Columns 154 through 162 0.0015 0.0015 0.0016 0.0016 0.0016 0.0016 0.0016 0.0016 0.0016 Columns 163 through 171 0.0016 0.0016 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 0.0017 Columns 172 through 180 0.0017 0.0018 0.0018 0.0018 0.0018 0.0018 0.0018 0.0019 0.0019 Columns 181 through 189 0.0019 0.0020 0.0020 0.0020 0.0020 0.0020 0.0020 0.0020 0.0020 Columns 190 through 198 0.0020 0.0020 0.0021 0.0021 0.0021 0.0021 0.0021 0.0021 0.0021 Columns 199 through 207 0.0021 0.0021 0.0021 0.0021 0.0021 0.0021 0.0021 0.0021 0.0021 Columns 208 through 216 0.0022 0.0022 0.0022 0.0022 0.0022 0.0022 0.0022 0.0022 0.0022 Columns 217 through 225 0.0022 0.0023 0.0023 0.0023 0.0023 0.0023 0.0023 0.0023 0.0023 Columns 226 through 234 0.0023 0.0024 0.0024 0.0024 0.0024 0.0024 0.0024 0.0024 0.0024 Columns 235 through 243 0.0024 0.0024 0.0024 0.0024 0.0024 0.0024 0.0024 0.0025 0.0025 Columns 244 through 252 0.0025 0.0025 0.0025 0.0025 0.0025 0.0025 0.0025 0.0025 0.0025 Columns 253 through 261 0.0025 0.0025 0.0025 0.0026 0.0026 0.0026 0.0026 0.0026 0.0026 Columns 262 through 270 0.0026 0.0026 0.0026 0.0026 0.0027 0.0027 0.0027 0.0027 0.0027 Columns 271 through 279 0.0027 0.0027 0.0027 0.0028 0.0028 0.0028 0.0028 0.0028 0.0028 Columns 280 through 288 0.0028 0.0028 0.0028 0.0028 0.0028 0.0028 0.0028 0.0028 0.0028 Columns 289 through 297 0.0029 0.0029 0.0029 0.0029 0.0029 0.0029 0.0029 0.0029 0.0029 Columns 298 through 306 0.0029 0.0029 0.0029 0.0029 0.0029 0.0029 0.0029 0.0030 0.0030 Columns 307 through 315 0.0030 0.0030 0.0030 0.0030 0.0030 0.0030 0.0030 0.0030 0.0030 Columns 316 through 324 0.0030 0.0030 0.0030 0.0030 0.0031 0.0031 0.0031 0.0031 0.0031 Columns 325 through 333 0.0031 0.0031 0.0031 0.0032 0.0032 0.0032 0.0032 0.0032 0.0032 Columns 334 through 342 0.0032 0.0032 0.0032 0.0033 0.0033 0.0033 0.0033 0.0033 0.0033 Columns 343 through 351 0.0033 0.0033 0.0033 0.0033 0.0034 0.0034 0.0034 0.0034 0.0034 Columns 352 through 360 0.0034 0.0034 0.0034 0.0034 0.0035 0.0035 0.0035 0.0035 0.0035 Columns 361 through 369 0.0035 0.0035 0.0035 0.0035 0.0035 0.0035 0.0035 0.0035 0.0036 Columns 370 through 378 0.0036 0.0036 0.0036 0.0036 0.0037 0.0037 0.0037 0.0037 0.0037 Columns 379 through 387 0.0037 0.0037 0.0038 0.0038 0.0038 0.0038 0.0038 0.0038 0.0038 Columns 388 through 396 0.0038 0.0038 0.0039 0.0039 0.0039 0.0039 0.0039 0.0039 0.0039 Columns 397 through 405 0.0039 0.0039 0.0039 0.0039 0.0039 0.0039 0.0040 0.0040 0.0040 Columns 406 through 414 0.0040 0.0040 0.0040 0.0040 0.0040 0.0040 0.0040 0.0041 0.0041 Columns 415 through 423 0.0041 0.0041 0.0041 0.0041 0.0041 0.0041 0.0041 0.0041 0.0041 Columns 424 through 432 0.0041 0.0042 0.0042 0.0042 0.0042 0.0042 0.0042 0.0042 0.0042 Columns 433 through 441 0.0042 0.0042 0.0042 0.0042 0.0043 0.0043 0.0043 0.0043 0.0043 Columns 442 through 450 0.0043 0.0043 0.0043 0.0043 0.0043 0.0043 0.0043 0.0044 0.0044 Columns 451 through 459 0.0044 0.0044 0.0044 0.0044 0.0044 0.0044 0.0045 0.0045 0.0045 Columns 460 through 468 0.0045 0.0045 0.0045 0.0045 0.0045 0.0045 0.0046 0.0046 0.0046 Columns 469 through 477 0.0046 0.0046 0.0046 0.0046 0.0046 0.0046 0.0046 0.0047 0.0047 Columns 478 through 486 0.0047 0.0047 0.0047 0.0047 0.0047 0.0047 0.0047 0.0048 0.0048 Columns 487 through 495 0.0048 0.0048 0.0048 0.0048 0.0048 0.0048 0.0049 0.0049 0.0049 Columns 496 through 504 0.0049 0.0049 0.0049 0.0049 0.0049 0.0049 0.0049 0.0050 0.0050 Columns 505 through 513 0.0050 0.0050 0.0050 0.0050 0.0050 0.0050 0.0050 0.0050 0.0050 Columns 514 through 522 0.0050 0.0051 0.0051 0.0051 0.0051 0.0051 0.0051 0.0051 0.0051 Columns 523 through 531 0.0051 0.0051 0.0051 0.0052 0.0052 0.0052 0.0052 0.0052 0.0052 Columns 532 through 540 0.0052 0.0052 0.0052 0.0052 0.0052 0.0052 0.0053 0.0053 0.0053 Columns 541 through 549 0.0053 0.0053 0.0053 0.0053 0.0053 0.0053 0.0053 0.0053 0.0053 Columns 550 through 558 0.0053 0.0054 0.0054 0.0054 0.0054 0.0054 0.0054 0.0054 0.0054 Columns 559 through 567 0.0054 0.0055 0.0055 0.0055 0.0055 0.0055 0.0055 0.0055 0.0055 Columns 568 through 576 0.0055 0.0056 0.0056 0.0056 0.0056 0.0056 0.0056 0.0056 0.0056 Columns 577 through 585 0.0056 0.0057 0.0057 0.0057 0.0057 0.0057 0.0057 0.0057 0.0058 Columns 586 through 594 0.0058 0.0058 0.0058 0.0058 0.0059 0.0059 0.0059 0.0059 0.0059 Columns 595 through 603 0.0059 0.0059 0.0059 0.0059 0.0060 0.0060 0.0060 0.0060 0.0060 Columns 604 through 612 0.0060 0.0060 0.0060 0.0060 0.0060 0.0060 0.0060 0.0060 0.0060 Columns 613 through 621 0.0060 0.0061 0.0061 0.0061 0.0061 0.0061 0.0061 0.0061 0.0061 Columns 622 through 630 0.0061 0.0062 0.0062 0.0062 0.0062 0.0062 0.0062 0.0062 0.0062 Columns 631 through 639 0.0062 0.0062 0.0062 0.0063 0.0063 0.0063 0.0063 0.0063 0.0063 Columns 640 through 648 0.0063 0.0063 0.0063 0.0063 0.0063 0.0063 0.0063 0.0064 0.0064 Columns 649 through 657 0.0064 0.0064 0.0064 0.0064 0.0064 0.0064 0.0065 0.0065 0.0065 Columns 658 through 666 0.0065 0.0065 0.0065 0.0066 0.0066 0.0066 0.0066 0.0066 0.0066 Columns 667 through 675 0.0066 0.0067 0.0067 0.0067 0.0067 0.0067 0.0067 0.0067 0.0067 Columns 676 through 684 0.0067 0.0067 0.0067 0.0068 0.0068 0.0068 0.0068 0.0068 0.0068 Columns 685 through 693 0.0068 0.0068 0.0068 0.0068 0.0068 0.0069 0.0069 0.0069 0.0069 Columns 694 through 702 0.0069 0.0069 0.0069 0.0069 0.0069 0.0069 0.0069 0.0069 0.0069 Columns 703 through 711 0.0069 0.0069 0.0069 0.0070 0.0070 0.0070 0.0070 0.0070 0.0070 Columns 712 through 720 0.0070 0.0070 0.0070 0.0070 0.0070 0.0070 0.0071 0.0071 0.0071 Columns 721 through 729 0.0071 0.0071 0.0071 0.0071 0.0071 0.0071 0.0071 0.0072 0.0072 Columns 730 through 738 0.0072 0.0072 0.0072 0.0072 0.0072 0.0073 0.0073 0.0073 0.0073 Columns 739 through 747 0.0073 0.0073 0.0073 0.0074 0.0074 0.0074 0.0074 0.0074 0.0074 Columns 748 through 756 0.0074 0.0074 0.0074 0.0074 0.0075 0.0075 0.0075 0.0075 0.0075 Columns 757 through 7...

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

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

Suggested Problems

More from this Author100

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!