Preview

7 sorting scheme

Powerful Essays
Open Document
Open Document
1378 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
7 sorting scheme
THE SEVEN SORTING SCHEME
1. BUBBLE SORT
The bubble sort is generally considered to be the simplest sorting algorithm. Because of its simplicity and ease of visualization, it is often taught in introductory computer science courses. Because of its abysmal O(n2) performance, it is not used often for large (or even medium-sized) datasets.
ALGORITHM:
for i = 1:n, swapped = false for j = n:i+1, if a[j] < a[j-1], swap a[j,j-1] swapped = true → invariant: a[1..i] in final position break if not swapped end RUNNING TIME:

BEST CASE: The term best-case performance is used in computer science to describe an algorithm's behavior under optimal conditions. For example, the best case for a simple linear search on a list occurs when the desired element is the first element of the list.
Development and choice of algorithms is rarely based on best-case performance: most academic and commercial enterprises are more interested in improving average performance and worst-case performance. Algorithms may also be trivially modified to have good best-case running time by hard-coding solutions to a finite set of inputs, making the measure almost meaningless.[1]

AVERAGE CASE: Average performance is the most used in algorithm analysis. Less widely found is best-case performance, but it does have uses: for example, where the best cases of individual tasks are known, they can be used to improve the accuracy of an overall worst-case analysis. Computer scientists use probabilistic analysis techniques, especially expected value, to determine expected running times.

WORST CASE:
Worst-case performance analysis and average case performance analysis have some similarities, but in practice usually require different tools and approaches.
Determining what average input means is difficult, and often that average input has properties which make it difficult to characterise mathematically (consider, for instance,

You May Also Find These Documents Helpful

  • Good Essays

    Nt1420 Unit 6

    • 1145 Words
    • 5 Pages

    INSTRUCTIONS: 1. THERE ARE SIX (6) QUESTIONS IN THIS PAPER. 2. ANSWER FIVE (5) QUESTIONS ONLY. Question 1 Arrays are used when storing a large number of values. You are required to create an array named a and answer the following questions regarding array manipulation. a. Write a method fillRandom(int[] a, int min, int max), fill the array a with a random integer value. (Note: Math.random() returns a double in the range of 0.0 and 1.0, therefore it is cast to an integer number, between the minimum and maximum value). [6 marks] b. Write the Bubble sort method to sort array a into descending order. [10 marks] c. In the quicksort, an algorithm an element is chosen from the unsorted list. This element is called the…

    • 1145 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    Average Rate: when a rate is measured over a time interval; not useful for general calculations just specific intervals…

    • 379 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Aramark Executive Summary

    • 324 Words
    • 2 Pages

    Benchmarking Studies will help in identification of competitive benchmarks, which will help Aramark to monitor and improve performance metrics.…

    • 324 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    The two books I read over the summer were Counting By 7s by Holly Goldberg Sloan and The Maze Runner by James Dashner. The first book, Counting By 7s takes place in Bakersfield, California, and is about twelve year old Willow Chance who enjoys gardening, diagnosing medical conditions and the number seven. The story is about her journey through life after her parents died in a tragic car accident. Prior to the car accident Willow has to see Dell Duke, a student counselor, after being accused to cheater on a test because of her perfect score. During her counseling she meets Mai, and Quang-ha, who she lives with after the accident. Their house is a garage behind the nail salon that their mother, Pattie owns. Later on in the book Willow meets Jairo Hernandez, a taxi driver, who adventually gains…

    • 879 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    Algorithms – A problem solving procedure requiring repetition in order to eliminate possible answers until only the correct one remains.…

    • 2465 Words
    • 10 Pages
    Powerful Essays
  • Satisfactory Essays

    Statistics are used in our everyday lives and business decision making. Statistics is a mathematical analysis that involves the use of quantified models, summaries and representations for real world observation or a given set of empirical information. This type of analysis involves the process if analyzing and collecting information and then summarize the information into a numerical format.…

    • 412 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Heuristic- is an educated guess based on prior experiences that help narrow down the possible solutions for a problem. Also knows as a “rule of thumb”.…

    • 959 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Assignment 2

    • 338 Words
    • 2 Pages

    3.) Input, and display, the total of the numeric input after each input is entered. Average the numeric input, indicate lowest numeric input value and the highest numeric input value for the previous numeric inputs, before the next numeric input is asked for. (Example given in class)…

    • 338 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    o consider accuracy, efficiency and effectiveness when solving problems and reflect on what has been learnt…

    • 3070 Words
    • 13 Pages
    Powerful Essays
  • Powerful Essays

    Frequently, the result of an experiment will not be measured directly. Rather, it will be calculated from several measured physical quantities (each of which has a mean value and…

    • 1633 Words
    • 7 Pages
    Powerful Essays
  • Satisfactory Essays

    3. Determine the criteria or criterion that will be used to evaluate the alternatives. Problems that involve identifying the best solutions with respect to one criterion is as single–criterion decision problem while multiple problems with more than one criterion are multi-criterion decision problems.…

    • 600 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Benchmarking software can be used to organize large and complex amounts of information. Software packages can extend the concept of benchmarking and competitive analysis by allowing individuals to handle such large and complex…

    • 4783 Words
    • 20 Pages
    Good Essays
  • Satisfactory Essays

    Statistics Essay

    • 326 Words
    • 2 Pages

    Mean is the arithmetic average of a distribution, obtained by adding the scores and then dividing it by the number of scores there are. Median is the middle score in a distribution; half the scores are above it and half the scores are below it. Mode is the most frequently occurring score in a distribution.…

    • 326 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    simulation unisim

    • 1059 Words
    • 5 Pages

    Note: Optimization is not limited to this concept. It can be applied depending on the…

    • 1059 Words
    • 5 Pages
    Powerful Essays
  • Powerful Essays

    2. Draw a circuit diagram including the components in the materials list above, except the paperclips.…

    • 746 Words
    • 3 Pages
    Powerful Essays