I have a file system like this:
C Drive - Docements - (empty)
- Music - Rock - a.mp3
- Jazz - SmoothJazz - b.mp3
- Photo - (empty)
D Drive - (empty)
Every file or directory has an id, and its parent's id. Now given a file name or directory name, how do you find the full path of it?
My algorithm is:
Recursively (
if (parent id is not null)
find parent id in the table
)