Question: Write an R-script to initialize a vector with integers, then reverse the last 'k' elements of this vector leaving the other elements in the

Write an R-script to initialize a vector with integers, then reverse the last 'k' elements of this vector

Write an R-script to initialize a vector with integers, then reverse the last 'k' elements of this vector leaving the other elements in the same relative order without using any pre-defined function, also remove the duplicate elements from this reverse part (keep the 1st occurrence). Now display this updated vector. Example: INPUT: 8 10 15 12 30 25 40 25 50 37 if k=5, then OUTPUT: 8 10 15 12 37 50 25 40 30

Step by Step Solution

3.32 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The answer provided ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Network Questions!