please fill the dotted lines with appropriate code on the second picture.
... 7. To find the k-th smallest element in an array, you can sort the array, but that takes at least on log[n) time. You can do better than that Use the partition function to rearrange the array elements so that all elements in the first portion are less than all the elements in the second portion. Suppose there are elements in the first portion ks), then the k-th smallest element must be the the smallest element in the first portion. Recursively look there. Otherwise, the-th smallest element must be in the second portion. It's not the k-th element-you need to adjust by the size of the discarded first portion For comple, suppose the array is partitioned like this: 486792 11 15 29 13 To find the Sth smallest value you look in the first portion. To find the 8th smallest value, you look for the 2nd smallest value in the second portion. select.cpp 1/" tweeger care the first Integer to w Oparany the Second Steger top 3 6 volt.) 20 nt to + KY 10 11) 13 16 15 16 12 LE Partiti a portion of an array as they to partition refron the first tex of the portion to be partitioned art to the last of the portion to be partiti retut the last of the first partitions that all values in affrontare all valves in all aftol 21 t partition ist all. in front tol 20 221 23 24 25 26 i-1 i pit) [1 weit) i wpi) - 1 28 25 30 31 12 331 34 35 36 37 10 19 Selects the roles in an array Os cal te rond the test of the to the these the end, allest or the test is atrol > 41 in frontoint ) 45 4 tist Ir tol its pro may 15 paranather to artiti 16 taran from the first index of the porti e partition 12 paras to the last index of the portion to be partition 20 return to last Index of the first so that all values in affroalitse all alons in all 20 21 in partition all it frontatto 22 int ist from 24 Inti-front 25 1+1 26 will 27 26 14 Vital vettu) 29 wat all 30 il sa ilaj 31 ) 2 Tetun 1 2) 34 15 / 30 Select the last start doara a selents can be arranged 30 Barn from the first in the west 39 Goran to the worst Garn the kind west coast return the stra Where free 4 t selection all the front tant 40 in tinta ET - partita, fruta 11 - 49 se it fro1 11 52 51 14 55 > 43 30 TL leta 1) cute 1) out 1 11 1 34 ES 11 13 Code CRACK Rese G Search on ... 7. To find the k-th smallest element in an array, you can sort the array, but that takes at least on log[n) time. You can do better than that Use the partition function to rearrange the array elements so that all elements in the first portion are less than all the elements in the second portion. Suppose there are elements in the first portion ks), then the k-th smallest element must be the the smallest element in the first portion. Recursively look there. Otherwise, the-th smallest element must be in the second portion. It's not the k-th element-you need to adjust by the size of the discarded first portion For comple, suppose the array is partitioned like this: 486792 11 15 29 13 To find the Sth smallest value you look in the first portion. To find the 8th smallest value, you look for the 2nd smallest value in the second portion. select.cpp 1/" tweeger care the first Integer to w Oparany the Second Steger top 3 6 volt.) 20 nt to + KY 10 11) 13 16 15 16 12 LE Partiti a portion of an array as they to partition refron the first tex of the portion to be partitioned art to the last of the portion to be partiti retut the last of the first partitions that all values in affrontare all valves in all aftol 21 t partition ist all. in front tol 20 221 23 24 25 26 i-1 i pit) [1 weit) i wpi) - 1 28 25 30 31 12 331 34 35 36 37 10 19 Selects the roles in an array Os cal te rond the test of the to the these the end, allest or the test is atrol > 41 in frontoint ) 45 4 tist Ir tol its pro may 15 paranather to artiti 16 taran from the first index of the porti e partition 12 paras to the last index of the portion to be partition 20 return to last Index of the first so that all values in affroalitse all alons in all 20 21 in partition all it frontatto 22 int ist from 24 Inti-front 25 1+1 26 will 27 26 14 Vital vettu) 29 wat all 30 il sa ilaj 31 ) 2 Tetun 1 2) 34 15 / 30 Select the last start doara a selents can be arranged 30 Barn from the first in the west 39 Goran to the worst Garn the kind west coast return the stra Where free 4 t selection all the front tant 40 in tinta ET - partita, fruta 11 - 49 se it fro1 11 52 51 14 55 > 43 30 TL leta 1) cute 1) out 1 11 1 34 ES 11 13 Code CRACK Rese G Search on