TULISAN : LATIHAN SOAL OPERASI PADA STRING



Diketahui
S1 = {1,3,5,7,9}
S2 = {0,2,4,6,8}
S3 = {G,U,N,A,D,A,R,M,A}
S4 = {U,N,I,V,E,R,S,I,T,A,S}
S5 = {U,J,I,A,N}

1.CONCAT (SUBSTR (S1,2,3), DELETE (S2,2,3))

·         A = SUBSTR (S1,2,3)
A = {3,5,7}

·         B = DELETE (S2,2,3)
B = {0,2}

·         CONCAT A,B = {3,5,7,0,2}

2.LENGTH (CONCAT (SUBSTR (S3,5,5), DELETE (S4,3,3))

·         A = SUBSTR (S3,5,5)
A = {D,A,R,M,A}

·         B = DELETE (S4,3,3)
B = {U,N,R,S,I,T,A,S}

·         CONCAT A,B = {D,A,R,M,A,U,N,R,S,I,T,A,S}
·         LENGTH = 13

3.INSERT  (CONCAT (S2,S1), SUBSTR (S1,2.4),  LENGTH (S1))

·         A = CONCAT (S2,S1)
·         A = {0,2,4,6,8,1,3,5,7,9}

·         B = SUBSTR (S1,2,4)
·         B = {3,5,7,9}
·         LENGTH (S1) = 5

·         INSERT (A,B,5)
·         INSERT = {0,2,4,6,3,5,7,9,8,1,3,5,7,9}

4.DELETE (CONCAT (S2,S3), LENGTH (S2), LENGTH (INSERT (S2,S1,5))

·         INSERT (S2,S1,5) = {0,2,4,6,8,1,3,5,7,9}
·         LENGTH (S2,S1,5) = {10}
·         LENGTH (S2) = {5}

·         A = CONCAT (S2,S3)
·         A = {0,2,4,6,8,G,U,N,A,D,A,R,M,A}

·         DELETE (A,5,10) = {0,2,4,6}


5.SUBSTR (CONCAT (S3,S4) , LENGTH (S5), LENGTH (S2))

·         A = CONCAT (S3,S4)
·         A = { G,U,N,A,D,A,R,M,A,U,N,I,V,E,R,S,I,T,A,S}

·         LENGTH (S5) = {5}

·         LENGTH (S2) = {5}

·         SUBSTR (A,5,5) = { D,A,R,M,A }


6.CONCAT (DELETE (S4,5,5), (SUBSTR (S4,1,4))

·         A = DELETE (S4,5,5)
·         A = {U,N,I,V,A,S}
·         B = SUBSTR (S4,1,4)
·         B = {U,N,I,V}

·         CONCAT (A,B) = { U,N,I,V,A,S,U,N,I,V}


7.INSERT  (DELETE (S1,2,2), SUBSTR (S2,3,3), LENGTH (S5))

·         A = DELETE (S1,2,2)
·         A = {1,7,9}

·         B = SUBSTR (S2,3,3)
·         B = {4,6,8}

·         LENGTH (S5) = {5}

·         INSERT (A,B,5) = {1,7,9,{Ø},4,6,8}


8.SUBSTR (INSERT (S5,S3,1), 5, LENGTH (S5))

·         A = INSERT (S5,S3,1)
·         A = {G,U,N,A,D,A,R,M,A,U,J,I,A,N}

·         LENGTH (S5) = {5}

·         SUBSTR (A,5,5) = {D,A,R,M,A}


9.LENGTH (CONCAT (INSERT (S3,S4,1), INSERT (S4,S5,4))

·         A = INSERT (S3,S4,1)
·         A = {U,N,I,V,E,R,S,I,T,A,S,G,U,N,A,D,A,R,M,A}

·         B = INSERT (S4,S5,4)
·         B = {U,N,I,U,J,I,A,N,V,E,R,S,I,T,A,S}

·         CONCAT (A,B) = {U,N,I,V,E,R,S,I,T,A,S,G,U,N,A,D,A,R,M,A,U,N,I,U,J,I,A,N,V,E,R,S,I,T,A,S }

·         LENGTH = {36}


10.  DELETE (SUBSTR (INSERT (S3, (CONCAT (S4,S5), LENGTH (S5)), LENGTH (S1)),  4,4, (LENGTH (S2), 5)

·         A = CONCAT (S4,S5)
·         A = {U,N,I,V,E,R,S,I,T,A,S,U,J,I,A,N}

·         LENGTH (S5) = {5}

·         LENGTH (S1) = {5}

·         INSERT (S3,A,5) = {G,U,N,A,U,N,I,V,E,R,S,I,T,A,S,U,J,I,A,N,D,A,R,M,A}

·          




Komentar

Postingan Populer