Topic — Add New » Posts Last Poster Freshness
Merge Vs Quick Sort 3 Richipal 1 month

Java standard prefers merge sort , but c++ standard prefers quick sort , both have average time complexity of O(nlog n) then why we do so ?

How does cycle soft work? 1 1 month

I want to know how cycle sort works. Its code is at wikipedia, but i could not understand it. Cycle sort is the algorithm which performs minimum numbers of writes to the memory.

datastructure 2 suresh 2 months

SORTING NOT POSSIBLE FOR BELOW
1)INSERTION
2)SELECTION
3)INSERTION
4)DELETING

Special Sorting 2 kartik 2 months

Input: A unsorted array of size n.
Output: An array of size n.

Relationship:

> elements of input array and output array have 1:1 correspondence.
> output[i] is equal to the input[j] (j>i) which is smaller than input[i] and jth is nearest to ith ( i.e. first element which is smaller).
> If no such element exists for Input[i] then output[i]=0.

Eg.
Input: 1 5 7 6 3 16 29 2 7
Output: 0 3 6 3 2 2 2 0 0

Sorting Question 3 kartik 2 months

if we have set of n elements then

1) which sorting method uses least number of comparisons??

2) which sorting method uses least number of swaps??

3) suppose the array is 2 8 4 6 5 9
if we want to swap 8 and 5 the cost is 2(5-2)=6 .here 5 and 2 are indices of 5 and 8.
so what sorting method minimizes the cost, i want the answer in general case ,not for this particular array. it is also called least distance sorting

Write a program for followilg statement.. 4 2 months

In a given array of 1's and 0's arrange them in sorted order.ie 0's followed by 1's..

A Bubble sort question 2 2 months

when does worst case and best occur in bubble sort can you explain with one example

Worst case complexity of Heap Sort 2 kartik 2 months

what is complexity of worst case un heap sort

datastructure 4 2 months

what is the complexity of quick sort when all elements are equal

merge sort 1 3 months

Could you please explain merging unsorted lists?

use of standard lib fun qsort 1 rahul 3 months

plz give example how we use this fuc?

Microsoft Interview Question about Algorithms, Arrays 5 tanmaydude 3 months

How QuickSort is good in Virtual Memory Enviroment ?

Microsoft
Sort an array such that the smallest is between the second and third smallest nu 1 ram 3 months

write a program using c function to sort a number and the smallest should come in belween and the second smallest should come at the right of smallest and third smallest should come at the lefe of smallest and the other shold be in the same fashion.

Adobe Interview Question for Software Engineer/Developer about Algorithms 8 student 4 months

print permutations of a given string in sorted order

Adobe
tcs interview question 2 kartik 6 months

how bubble sort has an order of complexity of o(n) in best case give the analysis?

Sort the deck of cards with 5 different colors 5 7 months

Perform the in-place sort on a deck of cards with 5 different colors. Deck having n number of cards and we don't know the exact number of cards of each color.

e.g Lets desk having sequence of card as

Original deck:
BLACK WHITE BLUE RED BLUE WHITE YELLOW RED BLACK YELLOW

Sorted deck:
BLACK BLACK BLUE BLUE WHITE WHITE YELLOW YELLOW RED RED

Amazon Interview Question for Software Engineer/Developer about Algorithms, Arrays 2 smritedua 7 months

You are given an array of positive integers. Convert it to a sorted array with minimum cost (minimum number of operations). Only valid operation are
1) Decrement -> cost = 1
2) Delete an element completely from the array -> cost = value of element

For example:
4,3,5,6, -> cost 1 //cost is 1 to make 4->3
10,3,11,12 -> cost 3 // cost 3 to remove 3

Amazon