Alpha Geek

(8)

$10/per page/Negotiable

About Alpha Geek

Levels Tought:
University

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Environmental science,Essay writing,Programming,Social Science,Statistics Hide all
Teaching Since: Apr 2017
Last Sign in: 439 Weeks Ago
Questions Answered: 9562
Tutorials Posted: 9559

Education

  • bachelor in business administration
    Polytechnic State University Sanluis
    Jan-2006 - Nov-2010

  • CPA
    Polytechnic State University
    Jan-2012 - Nov-2016

Experience

  • Professor
    Harvard Square Academy (HS2)
    Mar-2012 - Present

Category > Computer Science Posted 03 May 2017 My Price 8.00

Bubble Sort

(Bubble Sort) Implement bubble sort—another simple yet inefficient sorting technique. It’s called bubble sort or sinking sort because smaller values gradually “bubble” their way to the top of the array (i.e., toward the first element) like air bubbles rising in water, while the larger values sink to the bottom (end) of the array. The technique uses nested loops to make several passes through the array. Each pass compares successive pairs of elements. If a pair is in increasing order (or the values are equal), the bubble sort leaves the values as they are. If a pair is in decreasing order, the bubble sort swaps their values in the array. The first pass compares the first two elements of the array and swaps their values if necessary. It then compares the second and third elements in the array. The end of this pass compares the last two elements in the array and swaps them if necessary. After one pass, the largest element will be in the last index. After two passes, the largest two elements will be in the last two indices. Explain why bubble sort is an O(n2) algorithm.

 

 

 

Answers

(8)
Status NEW Posted 03 May 2017 04:05 PM My Price 8.00

-----------

Attachments

file 1493828422-answer1.docx preview (213 words )
(-----------Bub-----------ble----------- So-----------rt)----------- Im-----------ple-----------men-----------t b-----------ubb-----------le -----------sor-----------t-----------an-----------oth-----------er -----------sim-----------ple----------- ye-----------t i-----------nef-----------fic-----------ien-----------t s-----------ort-----------ing----------- te-----------chn-----------iqu-----------e. -----------It-----------s----------- ca-----------lle-----------d b-----------ubb-----------le -----------sor-----------t o-----------r s-----------ink-----------ing----------- so-----------rt -----------bec-----------aus-----------e s-----------mal-----------ler----------- va-----------lue-----------s g-----------rad-----------ual-----------ly -----------“-----------bub-----------ble-----------”----------- th-----------eir----------- wa-----------y t-----------o t-----------he -----------top----------- of----------- th-----------e a-----------rra-----------y (-----------i.e-----------., -----------tow-----------ard----------- th-----------e f-----------irs-----------t e-----------lem-----------ent-----------) l-----------ike----------- ai-----------r b-----------ubb-----------les----------- ri-----------sin-----------g i-----------n w-----------ate-----------r, -----------whi-----------le -----------the----------- la-----------rge-----------r v-----------alu-----------es -----------sin-----------k t-----------o t-----------he -----------bot-----------tom----------- (e-----------nd)----------- of----------- th-----------e a-----------rra-----------y. -----------The----------- te-----------chn-----------iqu-----------e u-----------ses----------- ne-----------ste-----------d l-----------oop-----------s t-----------o m-----------ake----------- se-----------ver-----------al -----------pas-----------ses----------- th-----------rou-----------gh -----------the----------- ar-----------ray-----------. E-----------ach----------- pa-----------ss -----------com-----------par-----------es
Not Rated(0)