All Exams Test series for 1 year @ ₹349 only
Question

Which of the following algorithms have same order of complexity ?

 A. Deletion from Queue 

B. Worst case Search in Binary Search tree 

C. Insertion in Stack 

D. Quick Sort worst Case 

Choose the correct answer from the options given below :

The correct answer is
A and C only

Algorithm Complexity Analysis

To find algorithms with the same order of complexity, we need to determine the time complexity for each given operation:

  • A. Deletion from Queue: For standard queue implementations (like linked lists or circular arrays), removing an element from the front takes constant time. Complexity: $O(1)$.
  • B. Worst case Search in Binary Search Tree (BST): In the worst case, a BST can become unbalanced, resembling a linked list. Searching requires traversing the height of the tree. Complexity: $O(n)$, where $n$ is the number of nodes.
  • C. Insertion in Stack: For standard stack implementations (like linked lists or arrays), adding an element to the top takes constant time. Complexity: $O(1)$.
  • D. Quick Sort worst Case: The worst-case scenario for Quick Sort occurs with consistently poor pivot choices, leading to skewed partitions. Complexity: $O(n^2)$, where $n$ is the number of elements.

Comparing Complexities

Comparing the determined complexities:

  • Deletion from Queue: $O(1)$
  • Worst case Search in BST: $O(n)$
  • Insertion in Stack: $O(1)$
  • Quick Sort worst Case: $O(n^2)$

Algorithms A (Deletion from Queue) and C (Insertion in Stack) both have a time complexity of $O(1)$, meaning they have the same order of complexity.

Was this answer helpful?

Important Questions from Miscellaneous

  1. Which of the following relationships is/are not true?
    (A). Most probable velocity = $\sqrt{\frac{2RT}{M}}$
    (B). PV = $\frac{3}{2}kT$
    (C). Compressibility factor Z = $\frac{pV}{nRT}$
    (D). Average kinetic energy of gas = $\frac{1}{2}kT$
    Choose the correct answer from the options given below
  2. Match List-I with List-II
    List-IList-II
    Electronic ConfigurationFirst Ionisation energy (kJ mol$^{-1}$)
    (A). ns$^2$(I). 2100
    (B). ns$^2$np$^1$(II). 1400
    (C). ns$^2$np$^3$(III). 800
    (D). ns$^2$np$^6$(IV). 900

    Choose the correct answer from the options given below:
  3. The shielding constant of a 2p electron (calculated using Slater's rules) is
  4. Match List-I with List-II
    List-IList-II
    SpectroscopyProperty
    (A). Raman(I). Polarizability
    (B). FTIR(II). Dipole Moment
    (C). UV-Visible(III). Absorbance
    (D). NMR(IV). Spin

    Choose the correct answer from the options given below:
  5. The structure of protein comprises of:
    (A). Primary structure of protein is associated with amino acids
    (B). Secondary structure of protein is associated to peptides
    (C). Tertiary structure of protein is associated with polypeptide chains
    (D). Quaternary structure of protein is associated with polypeptide chains
    Choose the correct answer from the options given below:
Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App