You are on page 1of 9

1) What is data structure?

Answer: 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 designing of efficient algorithms for the manipulation of data. 2) What is an Array? Answer: Array is one data structure that has been used m ore than any other. An array is a finite collection of similar elements stored in adjacent memory location 3) What are the Array Operations? Answer: Traversal, searching, Insertion, Deletion, Sorting, Merging, Reversing. 4) What is Two-Dimensional Arrays? Answer: A 2-dimensional array is a collection of elements placed in m rows and n columns. for eg. Arr[0][2]. 5) What are strings? Answer: The way a group of integers can be stored in an integer array ,a group of character can also be stored in a character array. An array of characters is often called a String. 6) What are the operations of String? Answer: Length: Find the length of the string Copy: Copies the contents of one string to another Concatenate: Appends one String at the end of another String Compare: Compare two strings and finds whether they are identical or not. 7) What is Linked List? Answer: Linked list is a very common data Structure often used to store similar data in memory. While the elements of an array occupy contiguous memory locations, those of a linked list are not constrained to be stored in adjacent location. 8) What is the purpose of header node? Answer: Sometimes it is desirable to keep an extra node at the front of the list. Such a node does not represent an item in the list and is called the header node or a list header. 9) What are the advantages of linked lists? Answer: Overflow can never occur unless the memory is actually full. Insertions and deletions are easier than for contiguous (array) lists.

With large records, moving pointers is easier and faster than moving the items themselves. 10) What are the disadvantages of linked lists? Answer: The pointers require extra space. Linked lists do not allow random. Time must be spent traversing and changing the pointers. Programming is typically trickier with pointers 11) What is Circular Linked list? Answer: Link field in the last node contains a pointer to the first node rather then a NULL. Such a list is called a circular linked list. A circular linked list does not have a first and a last node. Circular Linked list can be used to represent a Stack and a queue. What is Doubly Linked List? We can Store in each node not only the address of next node but also the address of the previous node in the linked list .This arrangement is often known as a Doubly Linked list. 12) Define a Stack. Answer: A stack is an ordered collection of items into which new items may be inserted and from which items may be deleted at one end called the top of the stack. It is also called as Last In First Out (LIFO). 13) What are the operations of the Stack? Answer: There are two operations of stack 1. PUSH, 2.POP PUSH-Allowing adding an element at the top of the Stack. POP- Allowing to remove an element from the top of the Stack. 14) What is the main difference between ARRAY and STACK? Answer: Stack follows LIFO. Thus the item that is first entered would be the last removed. In array the items can be entered or removed in any order. Basically each member access is done using index and no strict order is to be followed here to remove a particular element .Array may be multi dimensional or one dimensional but stack should be one-dimensional. Size of array is fixed, while stack can be grow or shrink. We can say stack is dynamic data structure. 15) Parenthesis are never needed in prefix or postfix expressions. Why? Answer: Basically Parenthesis indicate the operations which need to be carried out first i.e. according to the BODMAS rule. SO in case of postfix or prefix expression they are actually conversions of the original standard equation. Where the brackets have already

been taken into consideration,,, and the formed prefix/postfix expression is the correct order of expansion of a given mathematical statement. 16) Define a queue. Answer: A queue is a ordered collection of items from which items may be deleted at one end (called the front of the queue) and into which items may be inserted at the other end (called the rear of the queue). It is also called as First in First out (FIFO). 17) What is the meaning of FRONT and REAR in queue? Answer: The end at which the deletion of an element takes place is called front. and the end at which insertion of a new element can take place is called Rear. 18) What is mean by d-queue? Answer: D-queue stands for double ended queue. It is a abstract data structure that implements a queue for which elements can be added to front or rear and the elements can be removed from the rear or front. It is also called head-tail linked list 19) Define priority queue. What are the types of Priority queue? Answer: The priority queue is a data structure in which the intrinsic ordering of the elements does determine the results. There are two types ascending priority queue is a collection of items into which items can be inserted arbitrarily and from which only the smallest item can be removed. descending priority queue. 20) What is Tree? Answer: A type of data structure in which each element is attached to one or more elements directly beneath it. The connections between elements are called branches. Trees are often called inverted trees because they are normally drawn with the root at the top. The elements at the very bottom of an inverted tree are called leaves. 21) What is Forest in data structure? Answer: Forest is a set of several trees that are not linked to each other in any way. Forest can be represented as a binary tree. 22) Define a binary tree. Answer: A binary tree is a finite set of elements that is either empty or is partitioned into three disjoint subsets. One subset is the left and one subset of the right and the third subset is the root of the tree. 23) What is a strictly binary tree? Answer: If every non leaf node in a binary tree has nonempty left and right sub trees, the tree is named as the strictly binary tree. 24) Define traversal in tree and what is the different type of traversals in tree?

Answer: To pass through the tree, enumerating each of its nodes once. Three types of traversals preorder traversal visit the root Traverse the left sub tree in preorder. Traverse the right sub tree in preorder in order traversal Traverse the left sub tree in preorder. visit the root Traverse the right sub tree in preorder post order traversal Traverse the left sub tree in preorder. Traverse the right sub tree in preorder visit the root 25) What are called leaf nodes? Answer: The nodes which dont have any sons are called as leaf nodes. 26) What are called internal and external nodes? Answer: The leaf nodes are called as external nodes and the non leaf nodes are called as internal nodes. 27) What is Threaded Binary tree? Answer: A Threaded Binary Tree is a binary tree in which every node that does not have a right child has a THREAD (in actual sense, a link) to its INORDER successor. By doing this threading we avoid the recursive method of traversing a Tree, which makes use of stacks and consumes a lot of memory and time. 28) What is AVL Trees? Answer: An AVL tree is a special type of binary tree that is always "partially" balanced. The criteria that is used to determine the "level" of "balanced-ness" is the difference between the heights of sub trees of a root in the tree. The "height" of tree is the "number of levels" in the tree. Or to be more formal, the height of a tree is defined as follows: The height of a tree with no elements is 0 The height of a tree with 1 element is 1 The height of a tree with > 1 element is equal to 1 + the height of its tallest sub tree. An AVL tree is a binary tree in which the difference between the height of the right and left sub trees (or the root node) is never more than one.

29) In an AVL tree, at what condition the balancing is to be done? Answer: If the pivotal value (or the Height factor) is greater than 1 or less than 1.If the balance factor of any node is other than 0 or 1 or -1 then balancing is done. The balancing factor is height. The difference in height of the right sub tree and right sub tree should be +1 ,-1 or 0 30) What are the various transformation performed in AVL tree? 1.single rotation - single L rotation - single R rotation -RL rotation 2.double rotation -LR rotation

31) What is the minimum number of nodes in an AVL tree of height h? The minimum number of nodes S(h), in an AVL tree of height h is given by S(h)=S(h1)+S(h-2)+1. For h=0, S(h)=1. 32) Define a B Tree? Answer: B-tree is a tree data structure that keeps data sorted and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-tree is a generalization of a binary search tree in that a node can have more than two children. In B-trees, internal (non-leaf) nodes can have a variable number of child nodes within some pre-defined range. When data is inserted or removed from a node, its number of child nodes changes. In order to maintain the pre-defined range, internal nodes may be joined or split. 33) What are the conditions for B tree? Answer: Every node has at most m children. Every node (except root) has at least m2 children. The root has at least two children if it is not a leaf node. A non-leaf node with k children contains k1 keys. All leaves appear in the same level, and carry information. 34) What are the applications of B-tree? Database implementation Indexing on non primary key fields 35) What is Heap? Answer: Heap is a complete binary tree. There are two types of Heaps. if the value present at any node is greater than all its children then such tree is called as the maxheap or descending heap. In case of a min-heap or ascending heap the value present in any node is smaller than all its children. 36) What is Searching

Answer: Searching is an operation Which finds the location of a given element in a list. The searching is said to be successful or unsuccessful depending on whether the element that is to be searched is found or not. 37) How many types of Searching? Answer: There are two standard searching methods Linear search , Binary Search. 38) What is Linear Search? Answer: This is the simplest method of searching. In this method, the element to be found is sequentially searched in the list. This method can be applied to a sorted or an unsorted list. 39) What is Binary Search? Answer: Binary search methods are very fast and efficient. This method requires that list of elements be in sorted order. In this method , to search an element we compare it with the element present at the center of the list 40) What is sorting? Answer: Sorting means arranging a set of data in some order. These are different methods that are used to sort the data in ascending or descending order. 41) What is External Sorting? Answer: When the Data to be sorted is so large that some of the data is present in memory and some kept in auxiliary memory then external sorting methods are used. 42) What is internal Sorting? Answer: If all the data that is to be sorted can be accommodated at a time in memory then internal sorting methods are used. 43) What is Bubble Sort? Answer: In this method , to arrange elements in ascending order ,to begin with 0 th element is compared with the 1st element. if it is found to be greater than the 1 st element then they are interchanged. Then the 1 st element is compared with the 2 nd element, if it is found to be greater, then they are interchange. In the same way all the elements are compared with their next element and are interchange if required. 44) What is the complexity of Bubble Sort Answer: The Complexity of Bubble Sort is O(n2) in all the Cases. 45) What is Selection Sort? Answer: This is the simplest method of sorting .in this method , to sort the data in ascending order ,the 0th element is compare with all other elements. If the 0 th element is found to be greater than the compare element then they are interchanged. So after the

1st iteration the smallest element is placed at the 0 th position. The same procedure is repeated for the 1st element and so on.. 46) What is the complexity of Selection Sort? Answer: The Complexity of Selection Sort is O(n2) in all the Cases. 47) What is Quick Sort? Answer: Quick sort is a very popular sorting method. the name comes from the fact that ,in general ,quick Sort can sort a list of data elements significantly faster than any of the common sorting algorithm. The basic strategy of quick sort is to divide and conquer. 48) What is the complexity of Quick Sort in Average & Best Case? Answer: The Complexity of Quick Sort is log2n. 49) What is the complexity of insertion sort in best case? Answer: The Complexity of insertion sort in best case is n-1. 50) What is the complexity of Heap sort ? Answer: The Complexity of Heap Sort is O (n log n) in all the Cases. 51) What is Merge Sort? Answer: Merging means combining two sorted lists into one sorted list. for this the element from both the sorted lists are compared. The smaller of both the elements is then sorted in the third array. the sorted is complete when all the elements from both the lists are placed in the third list 52) What is Merge sort complexity? Answer: The Complexity of merge Sort is O (n log n) in all the Cases. 53) Define a graph. Answer: A graph G consist of a nonempty set V which is a set of nodes of the graph, a set E which is the set of edges of the graph, and a mapping from the set for edge E to a set of pairs of elements of V. It can also be represented as G=(V, E). 54) Define weighted graph. Answer: A number is associated with each arc of a graph is called a weighted graph. The number associated with the arc is called the weight. 55) Define Depth First Traversal. Answer: Visits the successors of a visited node before visiting any of its brothers. In DFT, each visited node is placed in the stack. 56) Define Breadth First Traversal. Answer: Visits all successors of a visited node before visiting any successors of any of those successors. In BFT, each visited node is placed on the queue.

57) Differentiate BFS and DFS. DFS BFS Backtracking is possible from a Backtracking is not possible dead end Vertices from which exploration The is vertices to be explored incomplete Direction are processed in areaorganized as a are maintained Search is done in one particular The vertices in the same level LIFO order

58) What is a spanning Tree? Answer: A spanning tree is a tree associated with a network. All the nodes of the graph appear on the tree once. A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized. 59) Does the minimum spanning tree of a graph give the shortest distance between any 2 specified nodes? Answer: Minimal spanning tree assures that the total weight of the tree is kept at its minimum but it doesn't mean that the distance between any two nodes involved in the minimum-spanning tree is minimum. 60) What is hashing Answer: Hashing is a way retrieving records from memory in faster way. Record is inserted into memory by using hash function (division, midsqure, folding, digit analysis)and also records are retrieved using same hash function. 61) Classify the Hashing Functions based on the various methods by which the key value is found? Answer: Direct method, Subtraction method, Modulo-Division method, Digit-Extraction method, Mid-Square method, Folding method, Pseudo-random method. 62) How to create and delete a dynamic variable in C? Answer: malloc () is a function helpful for creating a dynamic variable. free() is a function helpful for deleting a dynamic variable.

63) What do you mean by: Syntax Error, Logical Error, Run time Error? Answer: Syntax Error-Syntax Error is due to lack of knowledge in a specific language. It is due to somebody does not know how to use the features of a language. We can know the errors at the time of compilation. logical Error-It is due to the poor understanding of the requirement or problem. Run time Error-The exceptions like divide a number by 0,overflow and underflow comes under this.

You might also like