Question 1: Given a circular list of characters randomly ordered. For each character 'a' in the list, it is requested to find the next greater character 'B' in the list, and then to replace 'a' by 'B'. If there is no greater character, replace 'a' by @. Given that A

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
i need the answer quickly
Question 1:
Given a circular list of characters randomly ordered. For each character 'a' in the list, it is
requested to find the next greater character 'B' in the list, and then to replace 'a' by 'B'. If
there is no greater character, replace 'a' by @'.
Given that A<B<C<...<X<Y<Z Explanation:
Example 1:
Considering each character and how it is replaced:
1) Consider E, it is requested to find the next greater
character. We can easily notice that D, B, A are not
greater than E, while K is the next greater
character. This is why E is replaced by K.
2) The same scenario happens with D, B, and A,
where they are all replaced by K.
3) Consider K, the next greater character is W, and
hence K is replaced by W.
4) Consider W, there is no character in such circular
list greater than W, and hence it is replaced by @.
5) Consider G, as this is a circular list, the next
character is E, which is not greater than G, while K
is the next greater character. This is why G is
replaced by K.
input: [E, D, B, A, K, W, G]
output: [K, K, K, K, W, @, K)
Similarly, here is another example:
Example 2, input: [K, M, Y, R, É, J, AJ]
output: [M, Y, @. Y, J, K, K]
a) Design a brute force algorithm to solve this problem
complexity. [explain your answer]
b) This problem belongs to which type of problems: P, NP, NP-Hard, NP-Complete?
and analyse its
explain why (
c) Design a more efficient algorithm to do the same task
of your algorithm (
(Important instruction to be followed: Create an arbitrary unsorted list of 7 characters and
use it to provide full explanation of how your proposed algorithm should work step by
step)
) analyse the complexity
Transcribed Image Text:Question 1: Given a circular list of characters randomly ordered. For each character 'a' in the list, it is requested to find the next greater character 'B' in the list, and then to replace 'a' by 'B'. If there is no greater character, replace 'a' by @'. Given that A<B<C<...<X<Y<Z Explanation: Example 1: Considering each character and how it is replaced: 1) Consider E, it is requested to find the next greater character. We can easily notice that D, B, A are not greater than E, while K is the next greater character. This is why E is replaced by K. 2) The same scenario happens with D, B, and A, where they are all replaced by K. 3) Consider K, the next greater character is W, and hence K is replaced by W. 4) Consider W, there is no character in such circular list greater than W, and hence it is replaced by @. 5) Consider G, as this is a circular list, the next character is E, which is not greater than G, while K is the next greater character. This is why G is replaced by K. input: [E, D, B, A, K, W, G] output: [K, K, K, K, W, @, K) Similarly, here is another example: Example 2, input: [K, M, Y, R, É, J, AJ] output: [M, Y, @. Y, J, K, K] a) Design a brute force algorithm to solve this problem complexity. [explain your answer] b) This problem belongs to which type of problems: P, NP, NP-Hard, NP-Complete? and analyse its explain why ( c) Design a more efficient algorithm to do the same task of your algorithm ( (Important instruction to be followed: Create an arbitrary unsorted list of 7 characters and use it to provide full explanation of how your proposed algorithm should work step by step) ) analyse the complexity
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY