# Data Structures Aptitude interview questions

What is the data structure?

A data structure is a way of organizing data that considers not only the items stored but also their relationship to each other. Advance knowledge about the relationship between data items allows the designing of efficient algorithms for the manipulation of data.

List out real-time applications of data structures?

- Designing of compilers
- Operating systems designs
- Database management systems
- Statistical analysis
- Graphs
- Numerical Analysis
- Artificial Intelligence
- Simulation

What type of data structure used in RDBMS?

RDBMS – Array (i.e. Array of structures)

What type of data structure used in the Network data model?

Network data model – Graph

What type of data structure used in the Hierarchical data model?

Hierarchical data model – Trees

How many minimum numbers of queues are required to implement the priority queue?

Two. One queue is used for actual storing of data and another for storing priorities.

Convert this expression ((A + B) * C – (D – E) ^ (F + G)) to equivalent Prefix and Postfix notations.

*Prefix Notation:*^ – * +ABC – DE + FG*Postfix Notation:*AB + C * DE – – FG + ^

Sorting is not possible by using which of the following methods?

InsertionSelectionExchangeDeletion

Using insertion we can perform insertion sort, using selection we can perform selection sort, using exchange we can perform the bubble sort (and other similar sorting methods). But no sorting method can be done just using deletion.

What type of pointer needs to use for a heterogeneous linked list?

The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing the pointer to any type as it is a generic pointer type.

Which data structures used to perform recursion?

Stack. Because of its LIFO (Last In First Out) property, it remembers its ‘caller’ so knows whom to return when the function has to return. Recursion makes use of system stack for storing the return addresses of the function calls.

Every recursive function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures are written, explicit stack is to be used.

Which notations are used in the evaluation of arithmetic expressions using a prefix and postfix forms?

Polish and Reverse Polish notations.

## Fresher Data Structures Aptitude interview questions

A binary tree with 10 nodes then how many null branches exist?

It should contain 11 null branches.

Let us take a tree with 5 nodes (n=5)

It will have only 6 (ie,5+1) null branches. In general, A binary tree with n nodes has exactly n+1 null nodes.

What are the methods available in storing sequential files?

- Straight merging
- Natural merging
- Polyphase sort
- Distribution of Initial runs

List out a few of the real-time application of tree data-structure?

- For manipulation of Arithmetic expression
- Symbol Table construction
- Syntax analysis.

List out a few of real-time applications for multilinked structures?

Sparse matrix, and index generation.

Which data structure is suitable to implement trees?

ArrayLinked listStackQueue

The linked list is used to implement a tree data structure

Which algorithm used in solving the 8 Queens problem?

Backtracking **algorithm used to solve queens problems**

What should be the condition to balance an AVL tree?

If the ‘*pivotal value*‘ or the ‘height factor’ is greater than 1 or less than –1.