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 |
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?
Which interfaces are implemented by enumset?
What is circular linked list?
How do I remove a value from a list?
How do you find the number of comparisons in bubble sort?
Which sort show the best average behavior?
What is hashing in cyber security?
What happens if we put duplicate key in hashmap?
Which is better merge or quick sort?
When is a graph said to be weakly connected?
What is a Breadth First Search? Give a few of its applications.