Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a. Section 1: The pseudo code of the bubble sort algorithm i. The input is a lis

ID: 3710690 • Letter: A

Question

a. Section 1: The pseudo code of the bubble sort algorithm i. The input is a list of unsorted integers (A) ii. The return is a list of sorted integers (B) b. Section 2: The pseudo code for an algorithm that verifies the correctness of a sorting algorithnm i. The inputs include 1. A list of unsorted integers (A) 2. A list of integers sorted by any sorting algorithm (B) ii. The return shall indicate whether B is correct ii. In this algorithm, you can call existing sorting function in Python to sort A, and then compare two c. Section 3: The pseudo code for a function that tests the i. The input is the total number of integers to be ii. The return is the amount of time used to sort N ili. You will need to generate an array of N random iv. To determine the amount of time for sorting, you sorted lists to see if they are identical time complexity generated (N) integers integers need to record the time before and after you call the sorting function. d. References

Explanation / Answer

a) : -------------->>>>>>>>>

procedure bubbleSort( list : array of items )

   loop = list.count;
  
   for i = 0 to loop-1 do:
      swapped = false
  
      for j = 0 to loop-1 do:
     
         /* compare the adjacent elements */  
         if list[j] > list[j+1] then
            /* swap them */
            temp = list[j]
            list[j] = list[j+1]
            list[j+1] = temp;
            swapped = true
         end if
        
      end for
     
      /*if no number was swapped that means
      array is sorted now, break the loop.*/
     
      if(not swapped) then
         break
      end if
     
   end for
  
end procedure return list

b) : -------------->>>>>>>>>>>

procedure checkSort(list:unsorted array item, list1 : sorted array item)
   //call any sorted function to sort the unsorted array
   bubbleSort(list)
   for i = 0 to list.length :
      if list[i] != list1[i+1] :
         print sorting algorithm is not correct
         return
      end if
   end for
   print sorting algorithm is correct
end procedure

C) : ---------------->>>>>>>>>

procedure checkTimeComplexity(N:number of item)
   //create a list of N item
   list = []
   for i to N :
      list[i] = rand();
   end for
   //store the current time in start
   start = currentTime()
   //calling sort function
   bubbleSort(list);
   //storing current time in end
   end = currentTime()
   return end - star

D) references go to tutorial point and search for bubble sort you can get the details

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote