View Single Post
  #1 (permalink)  
Old 05-17-2007, 06:40 PM
elle elle is offline
Newbie
 
Join Date: May 2007
Posts: 10
Rep Power: 0
elle is on a distinguished road
Default Finding non-standard sorting order via graph theory

Hi,

i'd like to ask you for some help with my problem. I need to find non-standard sorting order within some words. What do I mean non-standard order ? Standard sorting order is A..Z or Z..A. Non-standard is for example C,H,K,L,..Z. The solution of the problem should lie under theory of graphs.

For example some input/output:

Input: deer,deerp,ee,ers,rrp,sz

So in the case of input above the output (found non-standard order) will be
DERPSZ. Input is sorted with "unknown" non-standard sorting order.

My rough solution is something like that: First enumerate all unique char in each word and next look for ancestor/descendant inside graph.

deer : DER
deerp : DERP
ee : E
ers : ERS
rrp : RP
sz : SZ

Any idea ? Or just tip for algorithm ? Thanks in advance
Reply With Quote

Sponsored Links