# Basic CS-Algorithms [3i Infotech Placement]: Sample Questions 6 - 7 of 12

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

## Question 6

Algorithms

### Explanation

Answer is achieved by diving by

 Division by Quotient Remainder (decimal) Remainder (hex) Digit

So,

## Question 7

Algorithms
Edit

### Describe in Detail

Essay▾

What is the efficiency of merge sort

### Explanation

Assuming sorting of n elements in the entire array.

Step 1:

• The divide step takes constant time, regardless of the sub array size.
• Divide step computes the midpoint q of the indices p and r.
• We indicate constant time by .

Step 2:

• The conquer step, recursively sorts two subarrays of approximately elements.
• Account for that time when considering the subprograms.

Step 3:

• The combine step merges a total of n elements, taking time.
• The running time of two recursive calls on element- depends on the running merge sort on element array
• Each of sub problem size recursively sorts two subarrays of
• Now the problem is to find total merging time for all subproblems of size
• We now get down to subprograms of size 1: the base case.
• Spend time to sort subarrays of size 1.
• Each base takes time.