### Python online training by Mr Manikya Reddy, 8 years of real time experience

### Python has a solid claim to being the fastest-growing major programming language. Python is powerful and fast. It runs everywhere.

Duration : 5 week Beginner May 28 2018 at 7.30 am Sponsored by SrimanJavaGroup

## Thread: interview prospective

Forum : Collections
09-12-2017 07:21:56 PM

#### interview prospective

** What is time complexity? If you are going to implement sorting by your own which sorting you prefer? and why?**?

## Comments

## Brijesh

Newbie

Joined : Jun 29, 2017

Points : 100

Threads: 0

Posts: 5

## Re: interview prospective

What ever AMRIT say is correct but time complexity even depends on the devices on with our application are running i.e processer, latency.. etc.

And I will choose merge sort because it more stable, as we know quick sort performance better then n log(n) but it will not guarantee. Where as merge sort give performance of n log(n),but it give guarantee, and more stable.

Even our collection framework use merge sort because of the same reason.

I hope this will help you if any argument most welcome.

## Confirmation

Do you really want to make this post as 'Answered'?

## Confirmation

Do you really want to make this post as 'Un-Answered'?

## Amritk

Newbie

Joined : May 8, 2017

Points : 220

Threads: 56

Posts: 209

## Re: interview prospective

Time complexityis discribe the total amount oftimetaken by an algorithm to run as a function of the lengthof the input.

Sometimes, there are more than one way to solve a problem. We need to learn how to compare the

performance different algorithms and choose the best one to solve a particular problem. While analyzing an

algorithm, we mostly consider time complexity and space complexity. Time complexity of an algorithm quantifies the amount of time taken by an algorithm to run as a function of the length of the input. Similarly, Space complexity of an algorithm quantifies the amount of space or memory taken by an algorithm to run as a function of the length of the input.

Consider below example to understand time complexity..

Suppose we have an array A and an integer x and we have to find if x exists in array A.

for this we need to traverse the whole array A and check if the any element is equal to x. or not.

for i : 1 to length of A

## Confirmation

Do you really want to make this post as 'Answered'?

## Confirmation

Do you really want to make this post as 'Un-Answered'?

No More Comments