Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  What is the worst case time complexity of ins... Start Learning for Free
What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?
  • a)
    N
  • b)
    NlogN
  • c)
    N^2
  • d)
    N(logN)^2
Correct answer is option 'C'. Can you explain this answer?
Verified Answer
What is the worst case time complexity of insertion sort where positio...
Applying binary search to calculate the position of the data to be inserted doesn't reduce the time complexity of insertion sort. This is because insertion of a data at an appropriate position involves two steps:
1. Calculate the position.
2. Shift the data from the position calculated in step #1 one step right to create a gap where the data will be inserted. Using binary search reduces the time complexity in step #1 from O(N) to O(logN). But, the time complexity in step #2 still remains O(N). So, overall complexity remains O(N^2).
View all questions of this test
Most Upvoted Answer
What is the worst case time complexity of insertion sort where positio...
Applying binary search to calculate the position of the data to be inserted doesn't reduce the time complexity of insertion sort. This is because insertion of a data at an appropriate position involves two steps:
1. Calculate the position.
2. Shift the data from the position calculated in step #1 one step right to create a gap where the data will be inserted. Using binary search reduces the time complexity in step #1 from O(N) to O(logN). But, the time complexity in step #2 still remains O(N). So, overall complexity remains O(N^2).
Free Test
Community Answer
What is the worst case time complexity of insertion sort where positio...
Explanation:

Binary Search for Insertion:
- In insertion sort, when using binary search to find the correct position for insertion, the worst case time complexity is O(N^2).
- This is because the binary search takes O(logN) time to find the correct position for insertion.

Insertion Time Complexity:
- Once the correct position is found using binary search, shifting all the elements to make space for insertion takes O(N) time.
- Thus, the total time complexity for insertion in this case is O(N) + O(logN) = O(N^2).

Overall Time Complexity:
- Since we have to find the correct position for each element in the array, the overall worst case time complexity of insertion sort using binary search is O(N^2).
Therefore, the worst case time complexity of insertion sort with binary search for insertion is O(N^2).
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Question Description
What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?a)Nb)NlogNc)N^2d)N(logN)^2Correct answer is option 'C'. Can you explain this answer? for Computer Science Engineering (CSE) 2025 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?a)Nb)NlogNc)N^2d)N(logN)^2Correct answer is option 'C'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?a)Nb)NlogNc)N^2d)N(logN)^2Correct answer is option 'C'. Can you explain this answer?.
Solutions for What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?a)Nb)NlogNc)N^2d)N(logN)^2Correct answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?a)Nb)NlogNc)N^2d)N(logN)^2Correct answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?a)Nb)NlogNc)N^2d)N(logN)^2Correct answer is option 'C'. Can you explain this answer?, a detailed solution for What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?a)Nb)NlogNc)N^2d)N(logN)^2Correct answer is option 'C'. Can you explain this answer? has been provided alongside types of What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?a)Nb)NlogNc)N^2d)N(logN)^2Correct answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?a)Nb)NlogNc)N^2d)N(logN)^2Correct answer is option 'C'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev