Hello can anyone give me some tips how to create this kind of structure of process with recursion: http://i.stack.imgur.com/uUnVi.png
I made this structure using fork() and pstree but for now all I am doing is bunch of if statements. Since I am reading input like 1 5 0 3 for the picture above I was wondering how could I make this use recursion. Any tips?
1 5 0 3 input means that the main process has one child. This one child has 5 children and out of those 5 children the first one (and 3. 4. 5.) doesn't have any and second has 3 children. The image shows how the input should look after those proceses run. I need some help how to construct that tree recursively so I can draw any type of input. For now I can only create this picture using if statements. But this only works for this very case.