Fun Trivia | Quizzes | Games | People | Services | Help | Me
Register - Log In
Sorting

Crafted by Trivia Architect Hegh

Fun Trivia : Quizzes : Software and Programming : Sorting

Introduction:
"How do computers sort data?"


1. One of the simplest sorting algorithms is called bubble sort. Do you know why?
    It encases each element in a 'bubble' before sorting them
    It's a mystery. Why is anything called what it is, really?
    The designer hoped more people would use his sort if it had a cute name
    Smaller elements 'bubble' to the top


2. In which case would an insertion sort perform best, assuming it was reading the array to be sorted from beginning to end (as opposed to randomly)?
    If the array was sorted in reverse order
    If the array was already sorted
    If the array was in a random order
    These will all perform equally well


3. What is the first change that selection sort would make to this sequence to put it into ascending order: "3 1 4 2"?
    1 3 4 2
    2 4 1 3
    3 2 4 1
    4 2 3 1


4. A mergesort works by first breaking a sequence in half a number of times so it is working with smaller pieces. When does it stop breaking the list into sublists (in its simplest version)?
    It's not the size that counts, it's how you use it!
    When each sublist has two elements
    When each sublist has one element
    After four splits


5. Quicksort works by choosing a pivot value and moving list elements around. Each element less than the pivot will be closer to the beginning of the list than the pivot, and each element greater than the pivot will be closer to the end of the list. By doing this operation many times with different pivots, the list will become sorted. For the fastest operation, which would be the best pivot value?
    The smallest value in the current sublist
    It doesn't matter, it will take just as long no matter what
    The largest value in the current sublist
    A value in the middle of the current sublist


6. Which algorithm would work best to sort data as it arrives, one piece at a time, perhaps from a network?
    Mergesort
    Selection sort
    Quicksort
    Insertion sort


7. Which of these sorting algorithms could easily be parallelized? (Given any number of extra computers to help with the task, which would require the least extra programming to have them work together to sort the list)?
    Mergesort
    Quicksort
    Bubble sort
    Selection sort


8. When would it be a good idea to use bubble sort?
    As a placeholder, until you implement something else
    Any of these
    In a database
    Anywhere you have a large dataset that needs sorting


9. A 'stable' sort is a sort that will not change the relative order of any pair of equal values in a list. Which of these is *not* a stable sort?
    Bubble sort
    Mergesort
    Quicksort
    Insertion sort


10. Which of the following sorting algorithms cannot be performed in-place (it needs scratch-space apart from the array being sorted)?
    Bubble sort
    Mergesort
    Quicksort
    Selection sort


report error/typo/spelling mistake (new window)
Copyright, FunTrivia.com. All Rights Reserved.
Legal / Conditions of Use