Question: # Written by *** for COMP9021 # # Given a sequence L of numbers, the greedy increasing subsequence of L, # say G, is inductively

# Written by *** for COMP9021 # # Given a sequence L of numbers, the greedy increasing subsequence of L, # say G, is inductively defined as follows: # - If L is of length at most 1 then G is L. # - If L is of the form (e_0, e_1, ..., e_n) with n >= 1, then: # - either e_1 is greater than e_0, in which case G is e_0 followed by the # greedy increasing subsequence of (e_1, ..., e_n), # - or e_1 is less than or equal to e_0, in which case G is the greedy # increasing subsequence of (e_0, e_2,..., e_n). # # 1. Generates a random list L of digits whose length is chosen by the user # (done). # 2. Displays L (done), # 3. Displays the integer made from these digits (without the leading 0s, # if any). # 4. Graphically displays the greedy increasing subsequence of L as # horizontal bars. # 5. Graphically displays the nonzero values in L as steps.

from random import seed, randrange import sys

try: for_seed, length = (int(x) for x in input('Enter two integers, the second ' 'one being strictly positive: ' ).split() ) if length

# Written by *** for COMP9021 # # Given a sequence L

$ python3 quiz_1.py Enter two integers, the second one being strictly positive: 165 10 Here are the generated digits: [0, 0, 6, 1, 7, 3, 2, 6, 5, 9] The integer made from these digits is: 61732659 Here is the greedy increasing subsequence of values, horizontally displayed: Here are the nonzero values, displayed as stairs

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!