Some Important Questions and answers of Data structure and algorithms.

Some Important Questions and answers

  1. Arrange the following in the order of their time complexity? O(1),O(2n), O(n2), O(nlogn),O(n3),O(n), O(logn)
    Ans: The required order is: O(1)< O(logn)< O(nlon)< O(n2)< O(n3)< O(2n)
  2. What will be the time complexity of the expression: n3/3+n2/2+n/4:
    Ans: O(n3)+O(n2)+O(n) = O(n3)
  3. Does every algorithm have a java program?
    Ans: We must assume that by “algorithm” we mean something composed of steps that are of a nature that can be performed by a computer. If so, then an algorithm can be expressed in the Java program. In particular, if an algorithm can be expressed in any other computer programming language, then it can be expressed in Java since all computer programming languages compute the same set of functions.
  4. Differentiate between linear and nonlinear data structure.
    S.N Linear Data Structure Non-Linear Data structure
    1 Data items are arranged in a linear sequence Data items are arranged in a nonlinear sequence.
    2 An item is attached either to previous or to next of list Data item is attached to many other ways in specific ways
    3 Direct access is available for a linear data structure Random access is used in the nonlinear data structure
    4 Linked list, stack, array, etc are linear data structure Trees, Graphs are an example of nonlinear data structures
    5 Linear data structures are slow processing data structures Nonlinear data structures are faster processing data structures
  5. 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 manipulations of data.
  6. List of the various data structure operations.
    Ans: A large number of operations can be performed on data structures. Some of the important operations are specified as below:



You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *