Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Data Structures Questions and AnswersQ What are the different types of parameter passing ?There are two methods of paramet...
Ans : There are various features of the linked list because of which thelinkedrepresentation is preferred.. They are liste...
Upcoming SlideShare
Loading in …5
×

Data structue q & a

111 views

Published on

data structure questions Answers

  • Login to see the comments

Data structue q & a

  1. 1. Data Structures Questions and AnswersQ What are the different types of parameter passing ?There are two methods of parameter passing –1. Call by value - The parameters that are passed to the function are actualvalues.2. Call by reference - In call by reference the parameters are taken by reference.Pointer variables are taken as parameters.Q List uut and define performance measures of an algorithem.Ans.: The performance of an algorithm can be measured by -1. Time complexity : The amount of time taken by an algorithm to execute, iscalled time complexity2. Space complexity: The amount of space taken required by an algorithm, is calledspace complexity.The time and space complexities are denoted by asymptotic notations. Using thesetwo measures we can decide whether an algorithm is efficient or not.Q What do you mean by the terms average case, best case and worst case timecomplexity?Ans : Average case : The time complexity which we get for certain set of input as aaverage value then it is called the average case time complexity.Best case : The time complexity which we get is very minimum for particularinputs then it is called the best case time complexity.Worst case : The time complexity which we get for certain inputs is maximumthen we call it as the worst case time complexity.Q Give two examplts of non-linear data structures which are widly used.Ans The widely used non-linear data structures are -1. Trees2 GraphsQ What do you mean by linear data structure’?Ans The linear data structure is a kind of data structure in which data is in sequentialmanner. There is no hierarchy followed .Examples of linear data structures are Arrays Linked lists StacksQ. Explain the term dynamic memory.Ans The dynamic memory allocation means one can allocate the memory of requiredsize, as well as de allocate (free) it. So that freed memory can be utilized further.Also the memory can be real1ocated.Q Why the linked representation is preferred ?
  2. 2. Ans : There are various features of the linked list because of which thelinkedrepresentation is preferred.. They are liste as follows,a) The memory allocation is dynamic. So the developer can allocate as well asde allocate the memory. And so no wastage of memory is there.b) Insertions and deletions of the data is easy.c) Physically the data can be deleted.Q What is the advantage of circular linked list?Ans: In the circular linked list the next pointer of the last node points to the firstnode of the linked list. So one can quickily access the first node when he is accessingthe last node which in turn improves the efficiency of the algorithm as compared tothe singly linked list.

×