Symantec Interview Question
Quality Assurance EngineersTeam: DLP
Country: United States
Interview Type: In-Person
Can it be as simple as iterating a tree using BFS ?
Consider Node is a folder
Node temp = root;
Queue queue = new Queue();
queue.add(temp);
while (!queue.isEmpty()) {
temp = queue.get();
if (temp != null) {
System.out.println(temp.name)
Node[] childrens = queue.getChildrens();
while (Node child : childrens) {
queue.add(child);
}
}
}
In Perl, on unix it is simple to list out the home directory and it's recursive directories and file using the "ls -ltR" command.
Run the command using `` operator (backtic)
++++++++++++
#!/usr/bin/perl
#!/usr/bin/perl
my @array = `ls -ltR /home`;
print " Dir structure \n @array \n";
+++++++++++++++++++
- jerry January 26, 2013