E7_Lab12_Solutions_Fall_2010 - Assigned: November 18 Fall...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Assigned: November 18 Fall 2010 Due: November 24 E7 Laboratory Assignment 12 The purpose of this lab is to introduce you to sorting and searching. Note: You will use MATLAB’s publish command (accessible in the Editor window via File -> Publish to HTML ) to generate a printable document that contains your code and your answers. You must turn in the printed copy to the appropriate homework boxes in the lab by 4:00 pm on November 24 . Your M-file used to generate the HTML document must be uploaded to bSpace, also by 4:00 pm. Name this file lastname firstname lab012.m . Please complete each problem as a separate cell in your script. Make sure that your published file is readable, e.g. wrap all comments and organize your code so that it is easy to read when printed. IMPORTANT: Do not forget to publish your separate M-files in your main script using type as in the previous assignment. Do not forget to upload to bspace all functions that were written in a separate M-file. For this assignment, you should be uploading 5 files total; lastname firstname lab012.m , SortCriteria.m , MergeSortMod.m , LinSearch.m , and BinSearch.m . 1. In this problem you will modify the mergesort algorithm that you were given in class. Read carefully over the function mergesort.m given in class and make sure you understand how it works. (a) The file code.mat is a cell array which contains a secret message that can be unscrambled when the cells are sorted appropriately. When sorting two real numbers, we ask: “is a > b ?”. When sorting two cells, however, we have to define what precisely is meant when we ask if one cell is “greater than” another cell. Each cell in code.mat contains a 1x2 double array. The first entry in the double array is the value that will be used to determine if one cell is “greater than” another. The sorting criterion that we will use is: ˆ Cell1 will be defined to be “greater than” Cell2 (that is, sorted after Cell2 ) if the sine of Cell1 { 1 } (1) is greater than the sine of Cell2 { 1 } (1) . The second entry in the double array represents a character that can be retrieved using the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 01/21/2011.

Page1 / 6

E7_Lab12_Solutions_Fall_2010 - Assigned: November 18 Fall...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online