1. Consider the following algorithm: Input: list a consisting N elements for i from 0 to len(a) generate a random number x if a[i]

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Would be glad if u can help me solve
VoLTE lE0
92%
D1 16:36
You
Just now
a. Convert these lists into a dictionary with 7 key/value pairs such that lists a and b indicate
key and value for each pair, respectively.
b. Sort the dictionary with respect to keys in descending order by utilizing methods and/or
built-in Python functions.
3. Implement Merge Sort & Insertion Sort algorithms in Python as presented in the lecture.
a. Modify these algorithms to sort any given list in descending order. Verify your code by
executing modified algorithms for a-[3,7,6,1,9,2,4,5,8].
b. Generate a random list b consisting of 100000 numbers in which each number from 1 to
100000 occurs exactly once. For this list, calculate execution time for both sorting
algorithms developed in part a.
c. Extend part b such that the same algorithm is repeated 10 times with different random
lists of the same size. It should also calculate the average solution time for each sorting
algorithm over 10 executions.
d. Calculate execution time for both modified algorithms considering the following list
c=[1,2,3, ... , 99999, 100000]. Briefly comment on the difference between the results of
part b and part e for respective algorithms.
Note: Comment out every "print" in the code except the one that displays execution time.
Transcribed Image Text:VoLTE lE0 92% D1 16:36 You Just now a. Convert these lists into a dictionary with 7 key/value pairs such that lists a and b indicate key and value for each pair, respectively. b. Sort the dictionary with respect to keys in descending order by utilizing methods and/or built-in Python functions. 3. Implement Merge Sort & Insertion Sort algorithms in Python as presented in the lecture. a. Modify these algorithms to sort any given list in descending order. Verify your code by executing modified algorithms for a-[3,7,6,1,9,2,4,5,8]. b. Generate a random list b consisting of 100000 numbers in which each number from 1 to 100000 occurs exactly once. For this list, calculate execution time for both sorting algorithms developed in part a. c. Extend part b such that the same algorithm is repeated 10 times with different random lists of the same size. It should also calculate the average solution time for each sorting algorithm over 10 executions. d. Calculate execution time for both modified algorithms considering the following list c=[1,2,3, ... , 99999, 100000]. Briefly comment on the difference between the results of part b and part e for respective algorithms. Note: Comment out every "print" in the code except the one that displays execution time.
VoLTE l a0
92%
D1 16:36
You
Just now
1. Consider the following algorithm:
Input: list a consisting N elements
for i from 0 to len(a)
generate a random number x
if a[i]<x
display a[i] is greater than x
else
for j from 1 to 10
display j*100
Convert the pseudocode into a Python program that can work with any list. Try with a list
consisting of 20 elements.
a.
Determine the time complexity of this algorithm via
b. calculating T(N) and converting into big O notation,
direct calculation with big O notation.
c.
2. Consider the following lists
a=["the", “system", “only", “dreams", “in", “total", “darkness"]
b=[40, 111, 55, 200, 91, 63, 500]
Transcribed Image Text:VoLTE l a0 92% D1 16:36 You Just now 1. Consider the following algorithm: Input: list a consisting N elements for i from 0 to len(a) generate a random number x if a[i]<x display a[i] is greater than x else for j from 1 to 10 display j*100 Convert the pseudocode into a Python program that can work with any list. Try with a list consisting of 20 elements. a. Determine the time complexity of this algorithm via b. calculating T(N) and converting into big O notation, direct calculation with big O notation. c. 2. Consider the following lists a=["the", “system", “only", “dreams", “in", “total", “darkness"] b=[40, 111, 55, 200, 91, 63, 500]
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY