## DATA STRUCTURE INTERVIEW QUESTION & ANSWERS

Technical

Follow Us

71. | What is a hash table? |
---|---|

Hash table (or hash map) is an associative container (that maps key to value) data structure. It supports efficient lookup for a given key and returns the corresponding value. |

72. | What are ordered and unordered data structures? |
---|---|

Ordered data structures keep the data in a specific order (such as sorted order) so that the data can be retrieved fast. An operation (for example, comparison operator) is used to find the ordering relationship between the objects stored in the data structure. Example for ordered data structure is a binary search tree where the elements are stored in an ordered manner (left node is smaller than the middle node and right node is bigger than the middle node).
Unordered data structures do not care for any ordering relationship between the elements that are stored in the data structure. For example, a hash table is an unordered data structure—it can store the data anywhere in the hash table and the exact location depends on the hash value {and the hash function used). |

73. | What is the difference between undirected graphs (graphs) and directed graphs (digraphs)? |
---|---|

A graph is a collection of nodes (or vertices) and lines (or edges) that connect these nodes. A graph G is mathematically given by the notation G = (V, E), where V is a set of vertices and E is a set
of edges). An undirected graph (graph) does not have any direction in other words, the edges (u, v) and (v, u) are same. Also, self-loops are not allowed. A directed graph allows direction in the edges, in other words, the edges (u, v) and (v, u) are different. Also, self-loops are allowed. |

74. | What are the common operations on data structures? |
---|---|

Traversal : Accessing each element exactly once in order to process it. The operation is called visiting the element. Searching : Finding the location of a given element. Insertion : Adding a new element to the structure. Deletion : Removing an existing element from the structure. Sorting : Arranging the elements in some logical order. This logical order may be ascending or descending in case of numeric key. In case of alphanumeric key, it can be dictionary order. Merging : Combining the elements of two similar stored structures into a single structure. |