Answer to Question #266802 in Python for Jony

Question #266802

Consider a schedule with 4 transactions with 1, 2, 3, and 4 operations respectively. Calculate the possible



number of



a) Serial schedules



b) Non serial schedules

1
Expert's answer
2021-11-16T00:45:38-0500

Source Code

def factorial(n):
    fact=1
    if(n==1):
        return n;
    else:
        for i in range(1,n+1):
            fact*=i
        return fact


sum1=1+2+3+4
total_num_schedule=factorial(sum1)/(factorial(1)+factorial(2)+factorial(3)+factorial(4))
print("Total number of schedules: ",total_num_schedule)


num_serial_schedule=factorial(4)


print("Number of serial schedule: ",num_serial_schedule)


num_non_serial_schedule=total_num_schedule- num_serial_schedule


print("Number of serial schedule: ",num_non_serial_schedule)

Output





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS