Assignment 1 Part 1 Task 2

84 views
Skip to first unread message

katie

unread,
Sep 22, 2020, 1:41:04 PM9/22/20
to cmpt-295-sfu
SFU ID: 301403922
Github username: katiesun138
Line and file: arraylist.c

Question: For Task 2, it states that previous values should be moved back, does that mean back of the arraylist or behind the just inserted value?

Thank you

b.minh96

unread,
Sep 22, 2020, 2:13:43 PM9/22/20
to cmpt-295-sfu
Values should be moved forward by 1 (behind the just inserted value). 
Example: Original array {1,2, 3, 4, 5}. Insert 7 at index 2, the the array becomes:
{1, 2, 7, 3, 4, 5}.
The element 3 originally is at index 2; now it's at 3. So it's been moved forward by 1.
Reply all
Reply to author
Forward
0 new messages