Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a report detailing the following: The definition of an algorithm Your definition should refer to the bubble sort example in fig. A below when

Write a report detailing the following:
The definition of an algorithm
Your definition should refer to the bubble sort example in fig. A below when explaining.
The process involved in building an application
The technical steps involved in the generation of code, from editing through compiling to
execution.
Analysis of the process of writing code, including the potential challenges faced.
An evaluation of the two implementations of the bubble sort algorithm given in appendices A (Appendix A is attached in screenshot)
and B considering aspects such as efficiency of implementation, coding standards and the
relationship between the algorithm (fig. A) and the code variants.
Fig A:
begin BubbleSort(array)
for all elements of array
if array[i]> array[i+1]
swap(array[i], array[i+1])
end if
end for
return array
End BubbleSort
Appendice A is attached in screenshot
Appendice B:
L =[45,67,12,5,30,19,62,28,51,10]
print('Original List:')
print(L)
forj inrange(0,10):
fori inrange(0,9):
ifL[i]>L[i+1]:
L[i], L[i+1]= L[i+1], L[i]
print('
Sorted List:')
print(L)Appendix A
,,
F1lenane: bubble_sort_functions.py
Author: Bob
Date: 1487?2822
Description: This nodule contains definitions of functions
dedicated to sorting algorithe inplenentations
,..
def swap(a,b) :
return b,a
def bubb1e_sort(nua_11st): # accepts a 11st of numbers and sorts then in ascending order
no_of_passes=1en(num_ilst)
swapped-False
for 1 in range (, no_of_passes):
for 1 in range(, no_of passes-1):
If nun_1ist[1] snum 11st[1+1]:
nun_11st[1], num_11st[1+1]=swap(num_1ist[1], num_11st[1+1])
siwapped-True
If no swapping takes place in one conplete pass,
all values are in order and sorting stops
if swapped-mFalse:
return
,,
Filenawe: bubble_sort_appondixA-py
Author: Bob
Date: 14? e7/2e22
Description: testbed file for sorting algorithes exercise
,.
fron bubble_sort_functions 1nport *
def main() :
11 st =[45,67,12,5,39,19,62,28,51,18]
print('Or1ginal List:")
print(11st)
bubble_sort(11st)
print('
Sorted List:")
print(11st)
ma1n()
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

From Zero To Data Hero With Chatgpt

Authors: Andrew Wu

1st Edition

B0CQRJPXD9, 979-8989523009

More Books

Students also viewed these Databases questions

Question

4-35. The two reporters (ran after) every lead enthusiastically.

Answered: 1 week ago