Week 2.md 645B

Week 2

Problem 1

Write a Java program to insert an element (specific index and value) into an array. Shifting the rest of the elements to the right

Index : 2
Value : 5
Original Array : [25, 14, 56, 15, 36, 56, 77, 18, 29, 49]                                                     
New Array: [25, 14, 5, 56, 15, 36, 56, 77, 18, 29]

Problem 2

Write a Java program to remove a specific element(by index) from an array.

Index : 1
Original Array : [25, 14, 56, 15, 36, 56, 77, 18, 29, 49]                                                     
After removing the second element: [25, 56, 15, 36, 56, 77, 18, 29, 49, 49]