Just some few comments/questions first.
1) you might want to think twice on that hungarian notation.
2) Does the order of the elements in the string matter? For example does the last element has to be the last ? So does the element position matters relative to its neighbors?
firstPerson
Industrious Poster
4,044 posts since Dec 2008
Reputation Points: 851
Solved Threads: 625
Skill Endorsements: 15
If the order doesn't matter then what you can do is
1) find the element A
2) If A does not exist then exit
3) Else if A does exist, then swap A with the last element in the array
4) Then simply set the last element to 0, and decrease the list's size
Then your done.
For me that notation is just a little annoying and sometimes can be in the way rather than helping me.
firstPerson
Industrious Poster
4,044 posts since Dec 2008
Reputation Points: 851
Solved Threads: 625
Skill Endorsements: 15
Question Answered as of 1 Year Ago by
firstPerson