Question 14323 – Theory-of-Computation
December 19, 2023
Question 14312 – Operating-Systems
December 19, 2023
Question 14323 – Theory-of-Computation
December 19, 2023
Question 14312 – Operating-Systems
December 19, 2023

Question 9846 – Arrays

Suppose you are given an array s[1…n] and a procedure reverse (s,i,j) which reverses the order of elements in a between positions i and j (both inclusive). What does the following sequence do, where 1 ≤ k ≤ n:

         reverse(s, 1, k) ;
         reverse(s, k + 1, n);
         reverse(s, l, n);  

Correct Answer: A

Question 3 Explanation: 
If we perform the three given open operations it will result left rotation by K positions. If we perform n time it will result the initial array.
A
Rotates s left by k positions
B
Leaves s unchanged
C
Reverses all elements of s
D
None of the above
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!