Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Let's assume for simplicity that only letters a-z appear in your texts.</p> <p>Initialize a list A with values a[i] = i for i = 1 to N (you will figure out yourself how big N should be).</p> <p>Perform (simulate) all your operations on A. After this analyze A to find required operations:</p> <p>Fist find required delete operations by finding missing numbers in A (they will form groups of consecutive values, one group stands for one delete operation). </p> <p>After this you can find required insert operations by finding sequences of consecutive letters (one sequence is one insert operation).</p> <p>In your example:</p> <p>init A:</p> <p>1 2 3 4 5 6 7 8 9 10</p> <p>Step 1 (+:2:ab):</p> <p>1 a b 2 3 4 5 6 7 8 9 10</p> <p>Step2 (+:1:cde):</p> <p>c d e 1 a b 2 3 4 5 6 7 8 9 10</p> <p>Step3 (-:4:1):</p> <p>c d e a b 2 3 4 5 6 7 8 9 10</p> <p>Now we search for missing numbers to find deletes. In our example only one number (namely number 1) is missing, so only 1 delete is required, so we have one delete operation: -:1:1 (In general there may be more numbers missing, every sequence of missing numbers is one delete operation. For example if 1, 2, 3, 5, 6, 10 are all missing numbers, then there are 3 delete operations: -:1:3, -:2:2, -:5:1. Remember that after every delete operation all indexes are decreased, you have to store total sum of former delete operations to calculate the index of current delete operation.)</p> <p>Now we search for character sequences to find insert operations. In our example there is only one sequence: cdeab at index 1, so we have one insert operation: +:1:cdeab</p> <p>Hope this is clear enough.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload