1 / 6

Introduction

Introduction. CS 46101 Section 600 CS 56101 Section 002 Dr. Angela Guercio Spring 2010. The sorting problem. Input: A sequence of n numbers 〈 a 1 , a 2 , …, a n 〉 .

lilly
Download Presentation

Introduction

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