Given a BST with n nodes, the algorithm should create a linked list that contains a decreasing order sorted array. The algorithm should have a worst case time complexity O(n). The signature of the function should be toList(T, L), where T is the root of the tree and L is a linked list.

The only operation that allowed to use in the linked list is InsertFront.

My attempt:

```
toList(T , L){
if (T == null) return
toList(T.right , L)
InsertFront(T)
toList(T.left , L)
}
```

What do you think about that?

Any suggestions will be great!

Thanks a lot!