[Tutor] What algorithm suits here

Steven D'Aprano steve at pearwood.info
Wed Jul 13 12:06:30 CEST 2011


Amit Sethi wrote:
> I have a list of dictionaries in this form.
> 
> { message : xyz
>   parent : 23
>   id : 25
> }
>  or
> { message : abc
> parent : None
> id : 25
> }
> 
> { message : cde
> parent : 28
> id : 32
> }
> 
> { message : cde
> parent : 23
> id : 35
> }
> 
> I want to make seperate the lists such that messages in same thread(

Separate the *lists* plural? Earlier, you said you have *one* list. 
Please explain what you mean, showing an example.


> The parent message and its child messages } come together . What is
> the best algorithm here


Define "best" -- easiest to write, simplest to understand, uses least 
amount of memory, something else?




-- 
Steven



More information about the Tutor mailing list