Question 8 [15 marks) Write a class method compress(String str, int max) which replaces n consecutive occurrences of pat

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Question 8 [15 marks) Write a class method compress(String str, int max) which replaces n consecutive occurrences of pat

Post by answerhappygod »

Question 8 15 Marks Write A Class Method Compress String Str Int Max Which Replaces N Consecutive Occurrences Of Pat 1
Question 8 15 Marks Write A Class Method Compress String Str Int Max Which Replaces N Consecutive Occurrences Of Pat 1 (23.65 KiB) Viewed 57 times
Question 8 [15 marks) Write a class method compress(String str, int max) which replaces n consecutive occurrences of pattern p by "@nkp", where '@' is an character with numeric value 64, n (>=2) is an integer value, p is the shortest) substring of str with repetition(s) and k is the length of p. The parameter max is the maximum length of pattern p which can be found by this method (i... maximum value of k). You can assume str contains letters only. For example, compress("abcbcbcdee", 4) returns "a@32bcd@21e". You may write additional methods if necessary (15)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply