Jaymond Flurrie
Well-known Member
- Joined
- Sep 22, 2008
- Messages
- 919
- Office Version
- 365
- Platform
- Windows
I'm once again trying to solve an array issue. This time I'm not even really sure do I need to solve it.
So, I have an array where I save the opened tags. Let's make this simple and say I just have string, ASDFASDF. When I read it from beginning to end, I place the read character in an array vOpened. Once I find a match (the same character again), another array, vPaired finds the one it matches, copies both locations and the character, and removes those both from vOpened.
So, let's see how it does it
First comes A, no match found from opened tags, so it goes to vOpened to spot 0
Then comes S, no match found from opened tags, so it goes to vOpened to spot 1
Then comes D, no match found from opened tags, so it goes to vOpened to spot 2
Then comes F, no match found from opened tags, so it goes to vOpened to spot 3
Then comes A, a match found from vOpened on spot 0, vPaired gets values 0, 4 (since this was the fifth character) and A
Then we get to my actual problem. Should I now somehow remove the rows 0 and 4? And if so, then how? Just looping thru vOpened and if a spot is not empty, then vTemp (or whatever) gets value in that not empty spot to it's next open spot? Then loop thru vTemp and when an empty is found, copy all earlier spots back to vOpened?
Did I count right, I need four loops for this all?
The reason why I said "I'm not even really sure do I need to solve it." is that if an array that has million spots with 999999 empty elements and the last one has one character there, does the array require a lot of memory?
So, I have an array where I save the opened tags. Let's make this simple and say I just have string, ASDFASDF. When I read it from beginning to end, I place the read character in an array vOpened. Once I find a match (the same character again), another array, vPaired finds the one it matches, copies both locations and the character, and removes those both from vOpened.
So, let's see how it does it
First comes A, no match found from opened tags, so it goes to vOpened to spot 0
Then comes S, no match found from opened tags, so it goes to vOpened to spot 1
Then comes D, no match found from opened tags, so it goes to vOpened to spot 2
Then comes F, no match found from opened tags, so it goes to vOpened to spot 3
Then comes A, a match found from vOpened on spot 0, vPaired gets values 0, 4 (since this was the fifth character) and A
Then we get to my actual problem. Should I now somehow remove the rows 0 and 4? And if so, then how? Just looping thru vOpened and if a spot is not empty, then vTemp (or whatever) gets value in that not empty spot to it's next open spot? Then loop thru vTemp and when an empty is found, copy all earlier spots back to vOpened?
Did I count right, I need four loops for this all?
The reason why I said "I'm not even really sure do I need to solve it." is that if an array that has million spots with 999999 empty elements and the last one has one character there, does the array require a lot of memory?