Here are some Steps that we learned in class, please follow: 1. List each symbol
ID: 2901773 • Letter: H
Question
Here are some Steps that we learned in class, please follow:
1. List each symbol in the string and the number of times it occurs.
H = 1, A = 4, L = 2, E = 1, K = 1
2. Calculate the total number of symbols in the string uses the probability that dividing the number of times the symbol uses each symbol.
(ie. H = 1, Total# = 9, 1/9 = .11)
0.11 0.11 0.11 0.22 0.44
*H *E *K *L *A
3. Create a forest consisting of single node trees, each of which has a weight (the probability the symbol is used).
Explanation / Answer
import java.util.Scanner; public class mainClass { public static void main (String[] args){ Scanner myScanner = new Scanner(System.in); System.out.println("Please enter array"); String inputString = myScanner.nextLine(); //input array entered myScanner.close(); char[] charTypes = {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9,`,~,!,@,#,$,%,^,&,*,(,),-,_,=,+,[,{,],},;,:}; char[] charArray = new char[inputString.length()]; for (int i =0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.