def gzk (xyz) : for ham in range (len (xyz) - 1): ham qux for foo in range (ham + 1, len (xyz)): if xyz [foo] < xyz [qux] : qux foo shm= xyz [ham] xyz [ham] = xyz [qux] xyz [qux] = shm my_list = [18, 64, 25, 45, 36, 58, 14, 66, 47, 19, 21, 54, 69, 44, 68, 27, 67, 15, 65

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
The code fragment above contains an implementation of one of the sorting algorithms that was discussed in class and a list of integers named my_list. If this algorithm were called to sort my_list then what would be the contents of that list after 4 iterations of the outermost loop of that algorithm? This question is internally recognized as variant 232.
 

Q8)

 
[18, 25, 36, 45, 14, 58, 47, 19, 21, 54, 64, 44, 66, 27, 67, 15, 65, 50, 68, 69]
 
[14, 15, 18, 19, 21, 25, 27, 36, 44, 45, 47, 50, 54, 58, 64, 65, 66, 67, 68, 69]
 
[14, 15, 25, 45, 36, 58, 18, 66, 47, 19, 21, 54, 69, 44, 68, 27, 67, 64, 65, 50]
 
[18, 64, 25, 45, 36, 58, 14, 66, 47, 19, 21, 54, 69, 44, 68, 27, 67, 15, 65, 50]
 
[18, 25, 45, 36, 58, 14, 64, 47, 19, 21, 54, 66, 44, 68, 27, 67, 15, 65, 50, 69]
 
[14, 15, 18, 45, 36, 58, 25, 66, 47, 19, 21, 54, 69, 44, 68, 27, 67, 64, 65, 50]
 
[14, 15, 18, 19, 21, 58, 25, 66, 47, 45, 36, 54, 69, 44, 68, 27, 67, 64, 65, 50]
 
[14, 15, 18, 19, 36, 58, 25, 66, 47, 45, 21, 54, 69, 44, 68, 27, 67, 64, 65, 50]
 
none of the above
def gzk (xyz):
for ham in range (len (xyz)
qux = ham
for foo in range (ham + 1, len(xyz)):
if xyz [foo] < xyz [qux]:
qux = foo
shm = xyz [ham]
1):
xyz [ham] = xyz [qux]
xyz [qux]
shm
[18, 64, 25, 45, 36, 58, 14, 66, 47, 19, 21, 54, 69, 44, 68, 27, 67, 15, 65, 50]
my_list
Transcribed Image Text:def gzk (xyz): for ham in range (len (xyz) qux = ham for foo in range (ham + 1, len(xyz)): if xyz [foo] < xyz [qux]: qux = foo shm = xyz [ham] 1): xyz [ham] = xyz [qux] xyz [qux] shm [18, 64, 25, 45, 36, 58, 14, 66, 47, 19, 21, 54, 69, 44, 68, 27, 67, 15, 65, 50] my_list
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Huffman coding
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education