Data Structure interview questions


26.What is a Simple Queue ?
Simple Queue. Simple queue defines the simple operation of queue in which insertion occurs at the rear of the list and deletion occurs at the front of the list.

27. What is a graph in data structure?
In computer science, a graph is an abstract data type that is meant to implement the undirected graph and directed graph concepts from the field of graph theory within mathematics. A graph data structure consists of a finite (and possibly mutable) set of vertices (also called nodes or points), together with a set of unordered pairs of these vertices for an undirected graph or a set of ordered pairs for a directed graph.

28. How linear differentiate from a nonlinear data structure?
The main difference between linear and non linear data structures is that linear data structures arrange data in a sequential manner while nonlinear data structures arrange data in a hierarchical manner, creating a relationship among the data elements. A data structure is a way of storing and managing data.

29.How do you search for a target key in a linked list
Step by step procedure
Apply sequential search.
Each node is traversed and compared with the target key
If it is different, then it follows the link to the next node.
This traversal continues until either the target key is found or if the last node is reached.

30. Difference between array and stack
The main difference between array and stack is that an array stores elements of the same type while a stack stores elements of different types.
STACK:
Ordered collection of items.
Dynamic object whose size is constantly changing as items are pushed and popped.
ARRAY:
Array is an ordered collection of items.
Array is a static object i.e. no of item is fixed and is assigned by the declaration of the array.
It contains same data types.
Array can be home of a stack

Author: user

Leave a Reply