What is the difference between selection sort and bubble sort?

1 Answer

Answer :

A: In selection sort, successive rounds are executed to select the element which is required to be placed in their sorted position, whereas, in bubble sort, every consecutive pairs of elements are compared and interchanged as required to place them in their sorted position.

If we are arranging an array is ascending order, then in selection sort, we get the smallest element at every pass, whereas, in bubble sort we get the largest element in every pass.

Related questions

Description : Which of the following is not a stable sorting algorithm? a) Insertion sort b) Selection sort c) Bubble sort d) Merge sort

Last Answer : b) Selection sort

Description : You have to sort a list L, consisting of a sorted list followed by a few ‘random’ elements. Which of the following sorting method would be most suitable for such a task ? (A) Bubble sort (B) Selection sort (C) Quick sort (D) Insertion sort

Last Answer : (D) Insertion sort

Description : Which of the following algorithms sort n integers, having the range 0 to (n2 -1), in ascending order in O(n) time ? (A) Selection sort (B) Bubble sort (C) Radix sort (D) Insertion sort

Last Answer : (C) Radix sort

Description : Which of the following is not the internal sort? A) Insertion Sort B) Bubble Sort C) Merge Sort D) Heap Sort

Last Answer : C) Merge Sort

Description : Which of the following sorting algorithm has the running time that is least dependant on the initial ordering of the input? a) Insertion sort b) Quick sort c) Merge sort d) Selection sort

Last Answer : d) Selection sort

Description : Which of the following algorithms has lowest worst case time complexity? a) Insertion sort b) Selection sort c) Quick sort d) Heap sort

Last Answer : d) Heap sort

Description : Consider the situation in which assignment operation is very costly. Which of the following sorting algorithm should be performed so that the number of assignment operations is minimized in general? a) Insertion sort b) Selection sort c) Heap sort d) None

Last Answer : b) Selection sort

Description : Which of the following algorithm pays the least attention to the ordering of the elements in the input list? a) Insertion sort b) Selection sort c) Quick sort d) None

Last Answer : b) Selection sort

Description : If the given input array is sorted or nearly sorted, which of the following algorithm gives the best performance? a) Insertion sort b) Selection sort c) Quick sort d) Merge sort

Last Answer : a) Insertion sort

Description : Which of the following is not an in-place sorting algorithm? a) Selection sort b) Heap sort c) Quick sort d) Merge sort

Last Answer : merge sort

Description : Which of the following is a stable sorting algorithm? a) Merge sort b) Typical in-place quick sort c) Heap sort d) Selection sort

Last Answer : a) Merge sort

Description : The command which transcribes the standard input to the standard output and also makes a copy of the same in a file is A. tee B. tr C. sort D. grep E. None of the above

Last Answer : A. tee

Description : Which command is used to sort the lines of data in a file in reverse order A. sort B. sh C. st D. sort -r E. None of the above

Last Answer : D. sort -r

Description : ………… is a sort of blueprint of the system Development Effort. A) MDP B) DMP C) MPD D) DPM

Last Answer : A) MDP

Description : Merge sort uses a) Divide-and-conquer b) Backtracking c) Heuristic approach d) Greedy approach

Last Answer : a) Divide-and-conquer

Description : Which of the following algorithm design technique is used in the quick sort algorithm? a) Dynamic programming b) Backtracking c) Divide-and-conquer d) Greedy method

Last Answer : Which of the following algorithm design technique is used in the quick sort algorithm? a) Dynamic programming b) Backtracking c) Divide-and-conquer d) Greedy method

Description : Which of the following sorting algorithm is in-place a) Counting sort b) Radix sort c) Bucket sort d) None

Last Answer : b) Radix sort

Description : Assuming there are n keys and each keys is in the range [0, m-1]. The run time of bucket sort is (A) O(n) (B) O(n lgn) (C) O(n lgm) (D) O(n+m)

Last Answer : (D) O(n+m)

Description : Given two sorted list of size 'm' and 'n' respectively. The number of comparison needed in the worst case by the merge sort algorithm will be (A) m x n (B) max (m, n) (C) min (m, n) (D) m + n – 1

Last Answer :  (D) m + n – 1

Description : If there are n integers to sort, each integer has d digits and each digit is in the set {1,2, ..., k}, radix sort can sort the numbers in: (A) O(d n k) (B) O(d nk) (C) O((d+n)k) (D) O(d(n+k))

Last Answer : (D) O(d(n+k))

Description : An ideal sort is an in-place-sort whose additional space requirement is ............... (A) O(log2n) (B) O(nlog2n) (C) O(1) (D) O(n)

Last Answer : Answer: C

Description : Which of the following operation is used if we are interested in only certain columns of a table? (A) PROJECTION (B) SELECTION (C) UNION (D) JOIN

Last Answer : (A) PROJECTION

Description : ‘AS’ clause is used in SQL for (A) Selection operation. (B) Rename operation. (C) Join operation. (D) Projection operation.

Last Answer : (B) Rename operation.

Description : In Activity-Selection problem, each activity i has a start time si and a finish time fi where si≤fi. Activities i and j are compatible if: (A) si≥fj (B) sj≥fi (C) si≥fj or sj≥fi (D) si≥fj and sj≥fi

Last Answer : (C) si≥fj or sj≥fi 

Description : .................. allows selection of the relevant information necessary for the data warehouse. (A) The Top-Down View (B) Data Warehouse View (C) Data source View (D) Business Query View 

Last Answer : Answer: A

Description : What is the difference between a sequential file and a random file?

Last Answer : Ans: Sequential file access is the method employed in tape drives where the files are access in a sequential manner. So if you have to get a file in the end of the tape you have to start ... Disks and Optical drives, wherever the files is placed it will go to that particular place and retrieve it.

Description : What is the difference between Call by value and Call by reference?

Last Answer : A: Call By Value : When a function is called by value, then the value of the actual parameter is copied to the formal parameter (i.e. a separate copy is made). Any changes made with the ... with the values at that address of the formal parameter affects (changes) the value of the actual parameter.

Description : What is the difference between naming conventions and naming rules?

Last Answer : A: Violating naming rules will result in a syntax error, whereas, violating naming conventions will not result in any error.

Description : What is the difference between keywords and reserved words?

Last Answer : A: Keywords have a special meaning in a language, and are part of the syntax. Reserved words are words that cannot be used as identifiers (variables, functions, etc.), because they are reserved by the ... goto is a reserved word but not a keyword (as a consequence, you cannot use it at all)

Description : What is the difference between linear and binary search?

Last Answer : A: Linear search does not require the array to be sorted, whereas, binary search requires that the array be sorted. Linear search checks for the search item in a linear fashion from the beginning cell till the end, ... tell what is control variable in your loop. So if your loop is for(int i = 1; i

Description : What is the difference between break and continue?

Last Answer : A: break keyword stops the complete loop and takes the control out of the loop, whereas, the continue keyword just stops the current iteration and takes the control to the next iteration.

Description : What is the difference between length() and length?

Last Answer : A: length() function is used to find the number of characters present in a String, whereas, length keyword is used to find the number if cells in an array.

Description : What is the difference between function overloading and function overriding?

Last Answer : A: In function overloading only the function name is same but function signature (list of parameters) is different, whereas, in function overriding both the function name as well as function ... is an example of static polymorphism, whereas, function overriding is an example of dynamic polymorphism.

Description : What is the difference between recursion and iteration?

Last Answer : A: Recursion is usually slower than iteration due to overhead of maintaining stack, whereas, Iteration does not use stack so it's faster than recursion. Recursion uses more memory than ... whereas, Iteration consume less memory. Recursion makes code smaller, whereas, Iteration makes code longer.

Description : What is the difference between do-while and while?

Last Answer : A: do-while lop is exit controlled (i.e. condition is checked at the exit) and runs at least once even if the condition is false whereas, while loop is entry controlled (i.e. condition is checked at the entry) and does not run even once if the condition is false.

Description : What is the difference between for and while?

Last Answer : A: The difference lies in the way they are commonly used. for loop is commonly used when the number of iterations are known whereas, while loop is commonly used when the number of iterations are not known.

Description : What is the difference between if and switch?

Last Answer : A: (a) if can compare conditions for all data types whereas, switch can only check integers and characters. (b) all kinds of relations can be checked using if whereas only equality relation can be checked using switch.

Description : What is the difference between casting and coercion?

Last Answer : A: Type Casting refers to Explicit type conversion i.e. When the conversion takes place with the programmer’s intervention, whereas, Coercion refers to Implicit type conversion i.e. When the conversion takes place on its own without the programmer’s intervention.

Description : What is the difference between throws and throw?

Last Answer : A: Using throws keyword, we can give system defined error message if any error occurs, while using throw keyword, we can force an exception and give user-defined error messages.

Description : What is the difference between print() and println() methods?

Last Answer : A: The print() functions prints a line and the control remains on the same line, whereas, the println() function prints a line and the control moves on to the next line.

Description : Methods can be overloaded with a difference only in the type of the return value .. A) Not supported B) False C) True D) None of the above

Last Answer : B) False

Description : _____ produces the relation that has attributes of R1 and R2 (A) Cartesian product (B) Difference (C) Intersection (D) Product

Last Answer : A) Cartesian product

Description : The essential difference between traps and interrupts is (A) traps are asynchronous and interrupts are synchronous with the program (B) traps are synchronous and interrupts are asynchronous with the program ( ... synchronous and interrupts are asynchronous with the I/O devices. (D) None of these.

Last Answer : (B) traps are synchronous and interrupts are asynchronous with the program

Description : A tree with n vertices is called graceful, if its vertices can be labelled with integers 1, 2, ...,n such that the absolute value of the difference of the labels of adjacent vertices are all different. Which of the following trees are ... (B) (b) and (c) (C) (a) and (c) (D) (a), (b) and (c)

Last Answer : Answer: D

Description : ECL is the fastest of all logic families. High Speed in ECL is possible because transistors are used in difference amplifier configuration, in which they are never driven into ............... (1) Race condition (2) Saturation (3) Delay (4) High impedance

Last Answer : Answer: 2  Explanation: Emitter-coupled logic (ECL) is the fastest of all logic families and therefore is used in applications where very high speed is essential. High speeds have become ... configuration, in which they are never driven into saturation and thereby the storage time is eliminated.

Description : How could this bubble level be wrong?

Last Answer : Yes, and you can check it with a regular level. Lay the level on the floor, or another flat surface and see how it reads. Then turn the level 180 degrees and read it again. I have a 4' level that I ... , since they both (the one on top side of level vs, the bottom, or other side bubble) weren't.