
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Lab; Class: Computer Organization; Subject: Engineering: Electrical; University: University of Central Florida; Term: Unknown 1989;
Typology: Lab Reports
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Laboratory Manual EEL 3801 Lab # Laboratory Assignment # EEL 3801 Introduction to Computer Engineering Topic: Nested looping in assembly language. Turn in: .LST file and screen output. Bubble S ort Write a program using a bubble sort algorithm to sort a string in ascending order stored in the data segment. Print out the string on the screen before and after the sort. Use a string of at least 20 characters in length and the starting string should not be in ascending order. The implementation of the bubble sort consists of a simple double loop. The first iteration of the inner for loop moves through the string from bottom to top, comparing adjacent characters. If the lower indexed character's value is higher than its higher-indexed neighbor, then the two values are swapped. Once the smallest value is encountered, this process will cause it to "bubble" up to the top of the array. The second iteration of the inner for loop repeats this process. Since the smallest value reached the top of the array on the first pass, there is no need to compare the top two elements on the second pass. Likewise, each succeeding pass through the array compares adjacent elements, looking at one less value than the preceding pass. The bubble sort algorithm is similar to the following: For i = 0 to string_length - 2 for j = string_length - 2 to i if string[j] > string[j + 1] then swap string[j] with string[j + 1]; Output: