write a program to show the insertion and deletion of an element in an array using the position



write a program to show the insertion and deletion of an element in an array using the position..

Answer / Dushyant Prakash

Here's a simple C++ example:n```nint arr[10]; // Array with size 10narr[0] = 5; // Inserting element at index 0nfor (int i = 0; i < 10; ++i)n{n cout << "Element at position " << i << " is " << arr[i] << endl;n}narr[2] = 7; // Replacing element at index 2narr[3] = -1; // Setting the deleted element to a default value to indicate deletionnfor (int i = 0; i < 10; ++i)n{n cout << "Element at position " << i << " is " << arr[i] << endl;n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

In which data structure, elements can be added or removed at either end, but not in the middle?

42 Answers   Infosys, NIC, TTA, Wipro,


What is worst case complexity algorithm?

1 Answers  


Which interfaces are implemented by enumset?

1 Answers  


What is circular linked list?

1 Answers  


How do I remove a value from a list?

1 Answers  


How do you find the number of comparisons in bubble sort?

1 Answers  


Which sort show the best average behavior?

9 Answers  


What is hashing in cyber security?

1 Answers  


What happens if we put duplicate key in hashmap?

1 Answers  


Which is better merge or quick sort?

1 Answers  


When is a graph said to be weakly connected?

1 Answers  


What is a Breadth First Search? Give a few of its applications.

1 Answers   Ciena,


Categories