reasoning under uncertainty cum dist_items[ ][ cumulative sum index for in randswhile >cumindex + cum +dist_items[index][ result append(dist_items[index][ ]return result exercise what is the time and space complexity the following methods to generate sampleswhere is the length of dist(an calls to sample one (bsample multiple (ccreate the cumulative distribution (choose how this is representedandfor each random numberdo binary search to determine the sample associated with the random number (dchoose random number in the range [ / ( )/nfor each range( )where is the number of samples use these as the random numbers to select the particles (does this give random samples?for each method suggest when it might be the best method the test sampling method can be used to generate the statistics from number of samples it is useful to see the variability as function of the number of samples try it for few samples and also for many samples probstochsim py -(continued def test_sampling(distnum_samples)"""given distributiondistdraw num_samples samples and return the resulting counts ""result { : for in distfor in sample_multiple(distnum_samples)result[ + return result try the following queries number of times eachtest_sampling({ : , : , : , : } test_sampling({ : , : , : , : } sampling methods for belief network inference samplinginferencemethod is an inferencemethodbut the query method also takes arguments for the number of samples and the sample-order (which is an ordering of factorsthe first methods assume belief network (and not an undirected graphical modelversion june