Data structure Quick reference - 9

47. What is Persistent data structure ?
The data structure is fully persistent if every version can be both accessed and modified. If there is also a meld or merge operation that can create a new version from two previous versions, the data structure is called confluently persistent. Structures that are not persistent are called ephemeral.

48. What are Primitives and Non primitive data types ?
Primitives are the most basic kinds of data types and they directly contain values. There are eight primitive types in total:
byte
short
int
long
char
boolean
float
double
Non primitive data types are called reference types in Java and they refer to an object. They are created by the programmer and are not defined by Java like primitives are. A reference type references a memory location where the data is stored rather than directly containing a value.

49. What is Modular Programming?
Modular Programming is a process that involves splitting a computer program into individual sub-programs. A module is an individual component which can be utilised with a number of functions and applications in combination with other components in a system. Identical functions are arranged together with the same programming code and separate functions are created as separate units of code making it available for reuse with other applications.

50. What is an Abstract Data Type ?
An abstract data type is a set of operations. ADTs are mathematical abstractions; now here in an ADT’s definition is there any mention of how the set of operations is implemented. Objects such as lists, sets and graphs, along with their operations can be viewed as abstract data types.

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.

1 2 3 4 5 6 7 8 9 10