Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me complete this python code. import random # 1. make list of numbers from to n1 # 2. randomly shuffle the list #
Please help me complete this python code.
import random \# 1. make list of numbers from to n1 \# 2. randomly shuffle the list \# 3. insert the random list elements in order into a tree. \# 4. return the height of the resulting ree. def run_single_experiment (n) : * your code here nums =[] for i in range (n) : nums. append (i) random. shuffle (nums) root = Node (nums [0]) for i in range (1,n) : root.insert (nums [i] ) return height (root) def run_multiple_trials( n, numTrials): lst_of_depths = [run_single_experiment (n) for j in range(numTrials)] return (sum(lst_of_depths)/len(lst_of_depths), lst_of_depths)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started