Question: Hi..

I have added aspxMemo control in my webpage :

```
txtComments.ClientSideEvents.KeyPress = "function(s,e){e.processOnServer = false;}";

```

but user can type every word in the textbox.. `e.processOnServer = false` doesn't effect

how can i prevent user to write single word in the MEmo control ?

Answer: 
Fill each y-level in a greedy fashion. After a level is filled, go one level down and never go back up.

Pseudocode:

```
 y <- 1
 while segment-list.not-empty
   i <- 1
   current <- segment-list[i]
   current.plot(y)
   segment-list.remove(i)
   i <- segment-list.find_first_greater(current.end)
   while (i > 0)
     current <- segment-list[i]
     current.plot(y)
     segment-list.remove(i)
   y <- y + 1

```

This does not necessarily produce an "optimal" plot in any sense, but at least it's O(n log n).
Can you not sort on the start value? Then you walk through the list from front to back. For each item, plot it, then do a binary search on the remainder of the list for the first item greater than the end coordinate of the item just plotted. If none is found, increase Y. Remove each item as you plot it.

The sort is O(N lg N) and the binary search is O(lg N) for each item, so the total is O(N lg N).