Computers and Technology

;to bubble sort, you need to scan the array n-1 times, ; in every scan, you compare from top down each two consecutive elements, and you swap them if they are not in ascending order. ; notice that in the first scan you get the largest element (no matter where it is in the array) pushed all the way to the bottom. ; so your next scan should be n-1 iterations, and then n-2 and so on. ; so every time you come back to the top of the array for a new scan, your n (the number of comparisons) must be decremented by 1. ; in the last scan, you need only one comparison. ; hints: ; your sorting algorithm starts with r6 as a pointer to the array ; you need to save n (number of elements) in r8, then decrement it by 1 (n-1) to become the number of comparisons. ; copy r6 to r7 so you keep r6 unchanged as it points to the top of the array for every new scan. ; copy n-1 to r9 and use r9 as a loop counter, while keeping the current n-1 value in r8 for the next scan. ; in the scan loop get an element and auto increment pointer r7, then get next element without changing r7. ; compare the two elements, if not in ascending order, swap them. ; repeat the scan from the top as pointed to by (r6), and every time decrement the number of comparisons (r8).

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:00, kmsg2000
Program description: a c# app is to be created to produce morse code. the morse code assigns a series of dots and dashes to each letter of the alphabet, each digit, and a few special characters (such as period, comma, colon, and semicolon). in sound-oriented systems, the dot represents a short sound and the dash represents a long sound. separation between words is indicated by a space, or, quite simply, the absence of a dot or dash. in a sound-oriented system, a space is indicated by a short period of time during which no sound is transmitted. the international version of the morse code is stored in the data file morse. txt.
Answers: 3
image
Computers and Technology, 23.06.2019 01:30, winstonbendariovvygn
1. which of the following is a search engine? a) mozilla firefox b)internet explorer c)google d)safari 2. which of the following statements is true? a) all search engines will provide the same results when you enter the same query. b) all search engines use the same amount of advertisements. c) some search engines are also browsers. d) search engines often provide different results, even when you enter the same query.
Answers: 2
image
Computers and Technology, 23.06.2019 10:00, austintules2005
Whats three fourths of 15(this is supposed to be in math but i clicked too fast)
Answers: 1
image
Computers and Technology, 23.06.2019 11:00, danielcano12281621
Sports and entertainment class, your goal is to increase attendance and make a profit for a game by getting your team on a winning track with total salaries less than $3,000,000
Answers: 3
Do you know the correct answer?
;to bubble sort, you need to scan the array n-1 times, ; in every scan, you compare from top down ea...

Questions in other subjects: