Search Interview Questions  More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. 

 
Algorithm  Interview Questions and Answers for 'Sorting'  13 question(s) found  Order By Newest  
_{}
 
Ans. List  
Help us improve. Please let us know the company, where you were asked this question :  
_{ Like Discuss Correct / Improve collections java sortingCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}  
Try 2 Question(s) Test  
 
Ans. Tree Set will sort the Values in the order in which Enum constants are declared.  
Help us improve. Please let us know the company, where you were asked this question :  
_{ Like Discuss Correct / Improve java collections set treeset enum sorting technical leadCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}  
_{}
 
Ans. The sorting algorithm is a modified mergesort. This algorithm offers guaranteed n log(n) performance.  
Help us improve. Please let us know the company, where you were asked this question :  
_{ Like Discuss Correct / Improve java algorithm collections collections.sort sorting algorithm expertCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}  
Try 1 Question(s) Test  
 
Ans. http://javasearch.buggybread.com/CodeSnippets/searchCodeSamples.php?&category=code&searchOption&keyword=952  
Help us improve. Please let us know the company, where you were asked this question :  
_{ Like Discuss Correct / Improve set collections sorting treeset code codingCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}  
_{}
 
^{This question was recently asked at 'HeadStrong,ServiceNow'.This question is still unanswered. Can you please provide an answer.}  
Help us improve. Please let us know the company, where you were asked this question :  
_{ Like Discuss Correct / Improve Search Algorithm Sorting Algorithm Asked in 2 Companies basic frequentCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}  
_{}
 
Ans. https://www.geeksforgeeks.org/heapsort/  
Help us improve. Please let us know the company, where you were asked this question :  
_{ Like Discuss Correct / Improve sorting heap sort Asked in 1 Companies frequentCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}  
_{}
 
Ans. https://javasearch.buggybread.com/InterviewQuestions/questionSearch.php?searchOption=label'  
Help us improve. Please let us know the company, where you were asked this question :  
_{ Like Discuss Correct / Improve Algorithm Sorting Algorithm Asked in 4 Companies basic frequentCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}  
_{}
 
Ans. array is traversed from first element to last element. Here current element is compared with next element. If current element is greater than next element it is swapped.  
Help us improve. Please let us know the company, where you were asked this question :  
_{ Like Discuss Correct / Improve sorting bubble sort Asked in 1 CompaniesCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}  
_{}
 
Ans. https://www.geeksforgeeks.org/arrayssortinjavawithexamples/  
Help us improve. Please let us know the company, where you were asked this question :  
_{ Like Discuss Correct / Improve array sorting Asked in 16 Companies basic frequentCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}  
_{}
 
Ans. Using comparable and comparator and sorted collections like TreeSet or TreeMap. or use stream api from java 8 onwards which internally refers to comparable and comparator through lambda expressions  
Help us improve. Please let us know the company, where you were asked this question :  
_{ Like Discuss Correct / Improve sort sorting comprator comparable treeset treemap sorting collections Asked in 1 Companies Basic frequentCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}  
_{}
 
^{This question was recently asked at 'Reddit,ServiceNow'.This question is still unanswered. Can you please provide an answer.}  
Help us improve. Please let us know the company, where you were asked this question :  
_{ Like Discuss Correct / Improve sorting algorithm in place sorting algorithm Asked in 2 CompaniesCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}  
 
Ans. public class SelectionSort { public static void main(String[] args){ int a[] = {1,3,4,5,7,8,2,6}; for(int i=0;i<a.length;i++){ for(int j=0;j<i;j++){ if(a[j] > a[j]){ int temporary = a[j]; a[j] = a[i]; a[i] = temporary; } } } for(int i=0;i<a.length;i++){ System.out.println(a[i]); } } }  
Help us improve. Please let us know the company, where you were asked this question :  
_{ Like Discuss Correct / Improve sorting algorithm selection sortCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}  
 
Ans. public class BubbleSort { public static void main(String[] args){ int a[] = {1,3,4,5,7,8,2,6}; for(int i=0;i<a.length1;i++){ for(int j=i;j<a.length;j++){ if(a[j] < a[j]){ int temporary = a[j]; a[j] = a[i]; a[i] = temporary; } } } for(int i=0;i<a.length;i++){ System.out.println(a[i]); } } }  
Help us improve. Please let us know the company, where you were asked this question :  
_{ Like Discuss Correct / Improve sorting algorithm Bubble sortCorrectionDuplicate of Another QuestionCompany where this question was AskedSuggestion}  