Data Structure interview questions


51. What is the network model ?
The network model is a database model conceived as a flexible way of representing objects and their relationships. Its distinguishing feature is that the schema, viewed as a graph in which object types are nodes and relationship types are arcs, is not restricted to being a hierarchy or lattice.

52. What is minimum spanning tree ?
A minimum spanning tree or minimum weight spanning tree is a subset of the edges of a connected, edge-weighted undirected graph that connects all the vertices together, without any cycles and with the minimum possible total edge weight. That is, it is a spanning tree whose sum of edge weights is as small as possible.

53. What is calloc and malloc?
calloc() gives you a zero-initialized buffer, while malloc() leaves the memory uninitialized.
For large allocations, most calloc implementations under mainstream OSes will get known-zeroed pages from the OS (e.g. via POSIX mmap(MAP_ANONYMOUS) or Windows VirtualAlloc) so it doesn’t need to write them in user-space. This is how normal malloc gets more pages from the OS as well; calloc just takes advantage of the OS’s guarantee.
This means calloc memory can still be “clean” and lazily-allocated, and copy-on-write mapped to a system-wide shared physical page of zeros. (Assuming a system with virtual memory.)

54. What does isempty() member method determines?
isEmpty() checks if the stack has at least one element. This method is called by Pop() before retrieving and returning the top element.

55. What method removes the value from the top of a stack?
The pop() member method removes the value from the top of a stack, which is then returned by the pop() member method to the statement that calls the pop() member method.

Author: user

Leave a Reply

Your email address will not be published. Required fields are marked *