1 / 6

Exploring the Sorting Problem: Algorithms and Insertion Sort

This course module covers the sorting problem, focusing on input sequences of numbers and their permutations. Students will learn about various algorithms, including their definition, analysis, and implementation. The concept of pseudocode will be introduced as a tool for expressing algorithms clearly and concisely. Special attention will be given to the Insertion Sort algorithm, including its best, worst, and average case analyses. Recommended reading is up to page 30 of the designated textbook, enhancing understanding of sorting techniques and computational processes.

lilly
Télécharger la présentation

Exploring the Sorting Problem: Algorithms and Insertion Sort

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction CS 46101 Section 600 CS 56101 Section 002 Dr. Angela Guercio Spring 2010

  2. The sorting problem • Input: A sequence of nnumbers 〈a1,a2, …, an〉. • Output: A permutation (reordering) 〈a’1, a’2, …, a’n〉of the input sequence such that a’1≤ a’2≤ …≤ a’n. • The sequences are typically stored in arrays. • We also refer to the numbers as keys. Along with each key may be additional information, known as satellite data.

  3. The sorting problem • We will see several ways to solve the sorting problem. Each way will be expressed as an algorithm: • a well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output.

  4. Expressing algorithms • We express algorithms in whatever way is the clearest and most concise. • English is sometimes the best way. • When issues of control need to be made perfectly clear, we often use pseudocode. • Pseudocode is similar to C, C++, Pascal, and Java. • Pseudocodeis designed for expressing algorithms to humans. Software engineering issues of data abstraction, modularity, and error handling are often ignored. • We sometimes embed English statements into pseudocodeunlike for “real” programming languages, we cannot create a compiler that translates pseudocodeto machine code.

  5. Insertion sort

  6. Next Time • Insertion Sort • The algorithm • Analysis of the algorithm • The best, the worst and the average case • Reading • Until page 30 of your book

More Related