Riverbed Interview Question for Software Engineer / Developers


Country: United States
Interview Type: Phone Interview




Comment hidden because of low score. Click to expand.
1
of 1 vote

An n-ary tree structure with the root being "/"?

- JustCoding September 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Many systems model it as a tree, where each file is a node. Directories are then treated as a type of file that can hold other files (nodes in the tree that can be parent nodes to other nodes). All non-directories are leaf nodes in such a system. File systems are usually hierarchical, so a tree is a logical choice for such systems.

- Anonymous September 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

What are the filesystem scenarios? (Eg: single machine or distributed, Space optimized, what kind of API to provide etc).

- Anonymous September 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

No, don't need to deep into this problem, just describe a brief idea about what data structure used in the file system.

- superffeng September 27, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@superfeng: The datastructure depends on the scenario etc!

- Anonymous October 03, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I would use composite patter.

interface Ifile{
          byte getFile();
     }
     class File implements Ifile{
         byte getFile(){
             //return conten of file
          };
     }

     class folder implements Ifile{
          List<Ifile> files;
        
          byte getFiles(){
              List<Ifile> return  = new ArrayList<Ifile>();
              forach(Ifile file:files){
                       if(file instanseof Folder){
                             return.addAll(file.getFiles());
                        }else{
                              return.add(file.getFile());
                            }
              }
          }     
       }

It does not run but you get the idea.

This is just pattern, If you need datastructure, maybe tries. kinda folder->file relationship

folder
file folder
file file folder
file folder file


...

- elbek September 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

One of the implementation is to use a prefixTree, where PrefixTree starts with \ and every path node is deliminated by \ for example.
\c:\program files\a.txt
\c:\program files\b.txt

\
/
c:
/
Program files
/ \
a.txt b.txt

So, the lookup will be always O(n), where n is the nodes in the path.

Infact, windows NTFS uses this as internal structure to store their path.

- Celestial September 28, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Filesystems uses B+ trees, btrfs is one filesystem which uses B trees (modified).

- shipra May 31, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class FileSystemNode{
String val;
FilesystemNode siblingPointer;
ArrayList<FileSystemNode> children;



}

B1--->C1
|
|--->C2
|
|--->C3

- sharmaaditi.nitsri February 11, 2017 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More