Java - Interview Questions and Answers for 'Select' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2137 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Select' - 1 question(s) found - Order By Newest

 Q1. Write a Program for selection sort.2017-07-27 11:59:53

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 sort


Related Questions

 Collections.sort can only be performed on ..

a. Set
b. List
c. Map
d. Any Collection implementation
  In what order the elements of a HashSet are retrieved ?
  If I try to add Enum constants to a TreeSet, What sorting order will it use ?
  Which sorting algorithm is used by Collections.sort() in Java ?
  If we add Enum constants to a sorted collection ( Treemap , TreeSet ), What will be the order in which they will be maintained ?
 Explain various Searching and Sorting Algorithms ?
 Write an algorithm / java program for Heap Sort ?
 Write any sorting algorithm.
 Explain bubble sort.
 Explain different sorting algorithms and Big O of each




Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: