- Home
- Interview Questions
- Data structures and Algorithms
A direct containment contains copies of objects.
An indirect containments contain pointers to objects.
Structure can be determined by calculating the sum of the sizes of all the primitive data types within the structure.
A pointer variable contains a memory address of another memory location, which is usually the memory address of another variable, element of a structure or attribute of a class. In C++ a pointer variable can be declared as: int * i ;
Static data structures allow fast access to elements but are expensive to insert/remove elements and have fixed, maximum size.
Dynamic data structures offer fast insertion/deletion of element but slower access to elements and have flexible size.
Referencing mechanism tells the computer to copy the memory address of the variable instead of copying the value stored in that memory address. A reference is distinct from the data itself. Typically, a reference is the physical address of where the data is stored in memory or in the storage device. For this reason, a reference is often called a pointer or address, and is said to point to the data.