Tell me about what you like and dislike Java.

Easy to use/learn. Garbage Collection.

OOD Project : simple database system

abstract class:operators handles the open/close /hasNext/of the iterators and have abstract methods such as return the children DbIterators of this operator and return TupleDescription of the output tuples of this operator

Aggregation/Insert/join extends this abstract class operators

Interface: DbFile The interface for database files on disk. Each table is represented by a
single DbFile. DbFiles can fetch pages and iterate through tuples. Each
file has a unique id used to store metadata about the table in the Catalog.
DbFiles are generally accessed through the buffer pool, rather than directly
by operators.

BTreeFile is an implementation of a DbFile that stores a B+ tree.

* Specifically, it stores a pointer to a root page,

* a set of internal pages, and a set of leaf pages, which contain a collection of tuples

* in sorted order. BTreeFile works closely with BTreeLeafPage, BTreeInternalPage,

* and BTreeRootPtrPage. The format of these pages is described in their constructors.

*

Tell me about your project.

I work as a database engineer intern at futuretwei technolgies at santa clara during last summer during which I studied two kinds of mobile database SQLite and Realm by building location-based android applications using these two kinds of database and perform database evaluation and testing. The app is retriving the meta-data from the photos in our album and perform queries like grouping the photos close to an location together, fetch the photos of a specific city, or group the photos according to timeline. The most important thing I learnt through this project is that I need to be creative and figure out the solutions on my own instead of always relying on my manager to give more hints, the project contains many possible thingkin of an android app and a way to write the queries.

How to implement a dictionary. (HashMap, Trie), Time complexity.

HashMap builds upon Hashing. Implement Map.entry interface which represent <key,object> pair in HashMap. HashMap use hashCode function to find a unique place for the object to lie in a bucket when using put( ) function and also rely on the hashCode function to find where the bucket is that store a specific object when using get( ). The Average get , put time is O(1) if the hash function distributes the object evenly across the bucket. We also need to implement equal function, which can assist when there is hash collision. More than one key has the same hash value..

Trie

Support fast string look up and prefix match .The values lies in leaf and the nodes't he descendants of a node have a common prefix of the string associated with that node

+: No need to provide hash functions, may be faster than an imperfect Hashmap.

-: Takes too much memory

Implementation: Use an array to represent the next value of the TrieNode

Polymorphism And Inheritance.

Polymorphism means that the subclass may change the behavior of a function in the superclass. Subclasses of a class can define their own unique behaviors and yet share some of the same functionality of the parent class.

Inheritance means that the sub class use the structure and behavior in super class

The main difference is polymorphism is a specific result of inheritance. Polymorphism is where the method to be invoked is determined at runtime based on the type of the object.

To create reference variable to super class and holding the

subclass

object =

>

an object can perform

multiple behaviours

Arraylist和linkedlist的区别,和什么时候你会选择用哪个

internal structure :dynamically re-sizing array vs double linkedlist . ArrayList fast to access random point but slow to add element. If we want to add or remove element in the middle of a list, use LinkedList. Also LinkedList takes more memory

Abstract Vs. Interface

Abstract classes are used for Modelling a class hierarchy of similar looking classes (For example Animal can be abstract class and Human , Lion, Tiger can be concrete derived classes. Interface is used for Communication between 2 similar / non similar classes which does not care about type of the class implementing Interface.Abstract classes are meant to be inherited

from, and when one class inherits from another it means that there is a strong relationship between the 2 classes.

good and bad: The interface is bad if we want to add more function to it. The abstract class if we want to create subclass under it.

Sell Java to me(他家用C++),说一说Java Memory Management的特点,我聊了一下JVM / Heap / Garbage Collection

Glossing over a lot of details, in Java you compile .java files into one or more .class files. In C++ you compile .cc (or whatever) source files into .o files, and then link the .o files together into an executable or library. The linking process is usually what kills you, especially for minor changes as the amount of work for linking is roughly proportional to the size of your entire project. (this is ignoring incremental linkers, which are specifically designed to not behave as badly for small changes)

Merge Sort VS Quick Sort

Quick sort: divide&conquer random pick a pivot and move all the smaller values before the pivot and all the large ones after the pivot,then recursively apply the same technique on the left parts and right parts of the array until the array size is 0 or 1. Worst Case N2 average NLogN

such as locality of reference (i.e. do we read lots of elements which are probably in cache?) – also play an important role on current hardware. Quicksort in particular requires little additional space and exhibits good cache locality, and this makes it faster than merge sort in many cases.

Merge Sort: divide the unsorted list into n sublist and recursively merge sublist until there are only one sublist remaining

What makes Quicksort better on average is that the inner loop implies comparing several values with a single one, while on the other two both terms are different for each comparison. In other words, Quicksort does half as many reads as the other two algorithms. On modern CPUs performance is heavily dominated by access times, so in the end Quicksort ends up being a great first choice.Also Quicksort is In-Place Algorithm while Merge Sort requires array when merging

Stack and Heap

Stack is used for static memory allocation and heap is used for dynamic memory allocation Variables allocated on the

stack are stored directly to the memory and access to this memory is very fast, and it's allocation is dealt with when the program is compiled.Variables allocated on the heap have their memory allocated at run time and accessing this memory is a bit slower, but the heap size is only limited by the size of virtual memory. Stack size less than the heap. Heap is shared among the threads while

Compare C++ and Java

Compare Python and Java

results matching ""

    No results matching ""