N
niklaus
Hi,
I have an array in which elements are present .
The number of elements n <= 10^6 .
Now if i delete an element in the array, i want to update the
array by moving all the elements to the left. It is very slow
considering the size of element and i want to access the array
with new updated indexes (it needn't be o(1) it can be atmost O(logn))
ex: 4 3 2 100
arr[2]=2;
once i access the index i delete the element,
So the new array should be 4 3 100, arr[2] should be now 100 etc.
Can someone suggest me a good way to solve this problem . Well i
thought
of STL maps but the problem with them is like if i delete an element in
an array
or map, how do i update the values of other elements to the right of
array (ie. decrease
the indexes by 1). This seems to be a tough task when using STL funcs.
The updation part of indices seems to be difficult
Reg
Nik
I have an array in which elements are present .
The number of elements n <= 10^6 .
Now if i delete an element in the array, i want to update the
array by moving all the elements to the left. It is very slow
considering the size of element and i want to access the array
with new updated indexes (it needn't be o(1) it can be atmost O(logn))
ex: 4 3 2 100
arr[2]=2;
once i access the index i delete the element,
So the new array should be 4 3 100, arr[2] should be now 100 etc.
Can someone suggest me a good way to solve this problem . Well i
thought
of STL maps but the problem with them is like if i delete an element in
an array
or map, how do i update the values of other elements to the right of
array (ie. decrease
the indexes by 1). This seems to be a tough task when using STL funcs.
The updation part of indices seems to be difficult
Reg
Nik