Assignment
In digital signal processing, it is important to implement some very fast algorithms that make initial processing of a digitized signal stream.
In this programming assignment, the students have to program simple implementation of such algorithms:
• Sorting the string following the bubble sort (bubble sort is a popular one in digital signal processing because it can be used as a partial sort without buffering of the stream as well as sorting by blocks).
• Counting the number of 1s in a string of words.
Every student has to write four subroutines: a main subroutine, print subroutine (ARM200), subroutine to count the number of 1s, and bubble sort subroutine.
Your main procedure:
• generates randomly a series of integers (11 words) using random.sor Random from Keiland puts them in anarray of words;
• calls the bubble sort subroutine;
• calls the subroutine to count the number of 0s of each word and accumulate the number of all 0s of the whole array;
Write and debug a subroutine, which counts the number of 0s in a word, located in the memory.
You are supposed to invent an algorithm, where the passes through the loop are equal to the number of 0s. For example, if the half word is 173F(16) your loop has to run 6 times and the count of 0s has to be 6.
(Hint: First significant operation in the loop should be increment (add 1) the given word. What is the next? Read again about logical operations!!!)
The bubble sort subroutine must sort the string in ascending order in classical nested loops.