Given array sequence: S=(6, 5, 4, 3, 2, 1)
a) S.replaceElementAtRank(0,7)
(7, 5, 4, 3, 2, 1)
b) S.insertElementAtRank(1,7); S.replaceElementAtRank(3,8)
(6, 7, 5, 4, 3, 2, 1) => (6, 7, 5, 8, 3, 2, 1)
c) S.removeElementAtRank(2); S.insertElementAtRank(4,S.elementAtRank(2))
(6, 5, 3, 2, 1) => (6, 5, 3, 2, 3, 1)
d) S.insertElementAtRank(1,S.elementAtRank(2)); S.removeElementAtRank(S.elementAtRank(4))
(6, 4, 5, 4, 3, 2, 1) => (6, 4, 5, 3, 2, 1)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment