Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(JAVA) Implement a decryption function decrpt(String s) to decrypt a number sequence (stored in a string s). (JAVA) 3. Secret Number. Implement a decryption function
(JAVA) Implement a decryption function decrpt(String s) to decrypt a number sequence (stored in a string s). (JAVA)
3. Secret Number. Implement a decryption function decrpt(String s) to decrypt a number sequence (stored in a string ) The decryption algorithm works as follows: 1. Delete the first element of the sequence 2. Move the first element of the sequence to the end 3. Delete the first element of the sequence 4. Move the first element of the sequence to the end 5. repeat... This process keeps running until all element in the sequence has been deleted. Then we put all deleted element together and output the result. Hint: Use a queue to implement this algorithm. E.g. Input: "631758924" Output: "615947283" 1 7 5 8 8 Deleted 3 1 7 2 4 lo UL 1 7 5 2 Deleted 6 Deleted 9 2 1 Delete the first Element Move the first Element to the End Delete the first Element Move the first Element to the End Delete the first Element Move the first Element to the End Delete the first Element Delete the first Element 9 2 4 3 7 1 TIIL 2 4 Deleted 6 Deleted 6 Deleted 6 Deleted! 1 5 4 3 11 5 Delete the first Element Deleted 6 Deleted 1 - 5 9 47 28 5 9 Decrypted Result 7 5 2 B 3 Figure 1: Decryption process for number "631758924" Input: "4589" Output: "4859
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started