Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It would be reasonable to assign 'am' or 'an' position to Item B and use binary division steps for another insertions. This resembles 26-al number system, where 'a'..'z' symbols correspond to 0..25.</p> <pre><code>a b //0 1 a an b //insert after a - middle letter of alphabet a an au b //insert after an a an ar au b //insert after an again (middle of an, au) a an ap ar au b //insert after an again a an ao ap ar au b //insert after an again a an ann ao... //insert after an, there are no more place after an, have to use 3--symbol label .... a an anb... //to insert after an, we treat it as ana a an anan anb // it looks like 0 0.5 0.505 0.51 </code></pre> <p>Pseudocode for binary tree structure:</p> <pre><code>function InsertAndGetStringKey(Root, Element): string if Root = nil then return Middle('a', 'z') //'n' if Element &gt; Root then if Root.Right = nil then return Middle(Root.StringKey, 'z') else return InsertAndGetStringKey(Root.Right, Element) if Element &lt; Root then if Root.Left = nil then return Middle(Root.StringKey, 'a') else return InsertAndGetStringKey(Root.Left, Element) Middle(x, y): //equalize length of strings like (an, anf)-&gt; (ana, anf) L = Length(x) - Length(y) if L &lt; 0 then x = x + StringOf('a', -L) //x + 'aaaaa...' L times else if L &gt; 0 then y = y + StringOf('a', L) if LL = LastSymbol(x) - LastSymbol(y) = +-1 then return(Min(x, y) + 'n') // (anf, ang) - &gt; anfn else return(Min(x, y) + (LastSymbol(x) + LastSymbol(y))/2) // (nf, ni)-&gt; ng </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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