Header Ads Widget

Data Structure

 Data Structure 








1. What is Data Structure?

It become the way of data that how to organize and manipulate the data. It shows some relationship between them. For instance, Stack, Queue and an arrays are connected. It is the vital portion of most of computer science algorithms.



2. What are the application of data structure?

The following Application :-

1. Operating System
2. Database system
3. Graphical applications
4. Artificial Intelligence
5. Statistical analysis package
6. Complier Design
7. Numerical Analysis


3. What is a stack?

It is an ordered list, where data can be insertion and deletion. It is a recursive data structure having pointer to its top. It is sometimes called by LIFO( Last in the first out) list.


4. What areas where stack data structure can be used?

1. Expression evoluation
2. Memory management 
3. Function calling and return
4. Backtracking


5. How many operations can be performed on a stack?

There are 3 kind of operations on a stack:-
▪︎ Peek Operation
▪︎ Push Operation
▪︎ Pop Operation


6. What is doubly linked list?

It is a complex type of linked list, where node contains a pointer to the previous as well as the next node in line. So, there are 3 parts of it:-

1. Pointer to the next node in sequence
2. Pointer to the previous node
3. Node data


7. Define the queue data structure. 

It is mainly an ordered list, which enables insert operations to be performed at one end called REAR and delete operations to be performed at another end called FRONT.









8. What is tree data structure?

Those set which have one or more nodes where one node is designated as the root of the tree, while others nodes are called children of the root.


9. How many types of trees in DS?

There are several kind of DS trees, which are mentioned below....

1. Forests
2. Binary tree
3. Binary Search Tree
4. Tournament Tree
5. General Tree
6. Expression Tree


10. Write the C code to perform in-order traversal on a binary tree.

void in-order(struct treenode *tree)
      {
          if(tree != NULL)
          {

              in-order(tree-> left);
              printf("%d",tree->root);
              in-order(tree->right);
          
          }
      }


11. What are the applications of tree data?

1. Syntax Analysis 
2. Hierarchal Data model
3. Symbol Table construction 
4. The manipulate of Arithmetic expression


12. Write the syntax in C to create a node in the singly linked list.

struct node
{
       int data;
       struct node*next;

};
struct node*head, *ptr;
ptr = (struct node*) malloc(sizeof(struct node));

13. Write down a code to calculate the height of a binary tree.

int countHeight(struct node*t)
{

      int l,r;
      if(!t)
            return 0;
      if ((!(t->left)) hh (!(t->right)))
            return 0;

     I=countHeight(t->left);
     r=countHeight(t->right);
     return(1+((l>r)?l:r));

}


14. What is the graph data structure? 

It can be defined in many ways, but this one is better. 

Graph G :- it is an ordered set G(V,E). 
V(G) :- Set of vertices
E(G) :- Set of Edges, which are used to connect vertices.


15. Which data structures are used in graph implementations? 

There are two type of data structure are used.

1. In linked representation, Adhacency list is used.
2. In Sequential representation, Adjacency matrix is used.



➽ This is model questions and answers, but this is also important question will be asked in any companies. So, be prepared for other complex questions.






Post a Comment

0 Comments