h******3 发帖数: 351 | 1 Explain the data structure and algorithms that you would use to design an in
-memory file system using java.
Assuming the file system supports any kinds of file resources (disk,
physical memory, etc)
class datablock{ byte[SIZE] byteArray; }
class vNode{ ArrayList datablocks;}
class Meta{ int size; Date last_modified; String extra_info;}
class File{
Meta metadata;
ArrayList nodes;
}
class directory{
Meta metadata;
ArrayList content;
}
class fileSystem{
void mount(){};
void unmount(){};
filed createFile(File f);
void closeFile(File f){};
dierectory createdir(directory dir);
}
the whole idea is similar to the solution on the book. I just feel using a
tree might be better.
welcome bricks. |
g**********y 发帖数: 14569 | 2 Directory could have sub-directories. You can check out Java implementation
to get ideas. |
d*******d 发帖数: 2050 | 3 directory 里面还可能有directory |
h******3 发帖数: 351 | 4 Here, directory is also a file which includes meta data and data blocks. So
is sub-directory.
Which implementation? tks.
implementation
【在 g**********y 的大作中提到】 : Directory could have sub-directories. You can check out Java implementation : to get ideas.
|
g**********y 发帖数: 14569 | 5 Java source code.
So
【在 h******3 的大作中提到】 : Here, directory is also a file which includes meta data and data blocks. So : is sub-directory. : Which implementation? tks. : : implementation
|
h******3 发帖数: 351 | 6 Yes, java implementation code, do you mind sharing the package/class name?
Also, do you happen to find the source code of Double.DoubletoLongBits? this
is a static native method in the source file. No idea where to find it.
BTW, how is your Amazon Onsite interview preparation?
【在 g**********y 的大作中提到】 : Java source code. : : So
|
x***n 发帖数: 70 | 7 请问什么叫in memory啊?
in
【在 h******3 的大作中提到】 : Explain the data structure and algorithms that you would use to design an in : -memory file system using java. : Assuming the file system supports any kinds of file resources (disk, : physical memory, etc) : class datablock{ byte[SIZE] byteArray; } : class vNode{ ArrayList datablocks;} : class Meta{ int size; Date last_modified; String extra_info;} : class File{ : Meta metadata; : ArrayList nodes;
|