Question: E . g . : If we have the 3 symbols below, and their respective uses: used 5 times. used 2 times. used 9 times.

E.g.: If we have the 3 symbols below, and their respective uses:
used 5 times.
used 2 times.
used 9 times.
Given that they add to a total use of 16, their frequencies will be:
0.3125(516)
0.125(216)
0.5625(916)
A static method called "sortSymbols()"
Takes in a Symbol array as input and returns no output.
It sorts the symbols by descending frequency (i.e.: the symbol with the highest frequency must be in the 0-th index and the symbol with the lowest frequency must be in the last index).
In the previous eximple, the symbols would have been sorted as such:
(0.5625)
0(0.3125)
0=(0.125)
If two symbols have the same frequency, they must be sorted by ascending codepoint value (i.e.: a symbol with a lower codepoint value must come before a symbol with a higher codepoint value).
See the table below to determine the ordering of the symbols we'll be using. The table is already sorted in ascending order by its codepoints.
You may not use any built-in sorting methods or libraries. You must write the sorting algorithm yourself.
You can find the Bubble Sort algorithm in the slides for 1321L, under Module 5 part 1.
The main method.
Creates an array of Symbols (called "symbols") of size 9 and fills it up with 9 Symbol objects using their overloaded constructor, with each Symbol object using one of the characters in the order they appear below:
\table[[Symbol,Codepoint],[,lu221E],[(4),lu263A],[9,lu2640],[0,lu2642],[4,142660],[4,lu2663],[v,142665],[+,lu2666],[d,142668]]
E . g . : If we have the 3 symbols below, and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!