Table of Contents

Cmps 240
(Spring 1996)
Data Structures
and Algorithms

Picture of dynamic insert

Syllabus

WeekTopic
1 (29 Jan)Introduction. Web page resources. Ch1: Preliminaries (Software development overview,
2 (5 Feb)Ch 2: Private vs. Limited private, Encapsulation (generic, polymorphic, child units)
3 (12 Feb)Ch 2: Tagged Types Test on Wednesday (Chs 1: Static types, Access types, linear linking.)
4 (19 Feb)Ch 2: Ada.Finalization, PART I: Linear Structures
5 (26 Feb)Ch 3: Stacks, Ch. 4 Queues, Intro to .Advanced child units
6 (4 Mar).Advanced and .Iterators child units
7 (11 Mar)Ch 5: Lists, Test on Wednesday (Access types, Stacks, and Queues, including .Advanced and .Iterators child units)
8 (18 Mar)Ch 5 (Con'd), Ch 6: Binary Trees,
9 (25 Mar)Chs 6
10 (1 Apr)
*********************** Break Week ***********************
11 (8 Apr)No class on Monday - Ch (Con'd)
12 (15 Apr)Ch 6 (tree traversals), Ch 7 AVL, complete trees, heaps
13 (22 Apr)Test on Wednesday, Test on Lists, Trees, heaps, AVL
14 (29 Apr)Chs 8,9,10: Digraphs, Sets, and Strings
15 (6 May)Chs. 11-12: Sorting and Searching
16 (13 May)
Final Exam (Monday 6pm)
Dr. Beidler's Home Page Course Directory Top of Page

Laboratory Assignments

Lab 1: The Lovelace Tutorial

Goal: The purpose of this laboratory assignment is to acquaint you with surfing the web and for you to take a look at the Lovelace tutorial that was written by David Wheeler of IDA. As the course progresses and you find yourself having difficulty with certain aspects of Ada, make use of this tutorial to gain insight into the various features of the language.

The Assignment: Use Netscape Navigator, either from the Suns, or from any other scource (there are some PCs that are on the net that have Netscape on them). Access the URL, http://academic.uofs.edu/faculty/beidler/. From that web page you can directly access the Lovelace tutorial. Spend some time browsing the tutorial. Complete at least one of the tutorial's Lessons.

Due Date: You must complete this laboratory assignment by 12 midnight Sunday February 4, 1996. NO EXCEPTIONS, NO EXCUSES. If you wait until the last minute and the system is down, the grade is "0".

What to Submit: In class you were assignned a lesson number. From the tutorial's Table of Contents click on your assigned lesson number and bring that lesson up. Pull down the File menu and use the Save option to same the page your viewing in a file. Simply email that file containing that page to beidler@cs.uofs.edu

Dr. Beidler's Home Page Course Directory Top of Page

Lab 2: Playing with Access Types

Goal: Learn about the basics of working with pointer (access types)

Assignment:Do the following:

Due Date: You must complete this laboratory assignment by 12 midnight Sunday February 11, 1996. NO EXCEPTIONS, NO EXCUSES. If you wait until the last minute and the system is down, the grade is "0".

What to Submit: Send me two email messages:

Dr. Beidler's Home Page Course Directory Top of Page

Lab 3: Playing with OOP

Goal: Gain some experience with type extension and dynamic dispatch using tagged types in Ada.

Assignment:

Due Date: You must complete this laboratory assignment by 12 midnight Sunday February 18, 1996. NO EXCEPTIONS, NO EXCUSES. If you wait until the last minute and the system is down, the grade is "0".

What to Submit: Send me two email messages:

Dr. Beidler's Home Page Course Directory Top of Page

Lab 4: Writing An Adjust Procedure

Goal: Write an Adjust procedure for a controlled type

Resources: You will need four file, a data file, the specifications and body for a polynomial package, and a procedure that uses the polynomial package:

Description: First of all compile the polynomial package, then compile, link, and run use_polynomial. When you run use polynomial note how the first pair of outputs for P and Q are different, after

           Q := P, 
the program adds a new term to P then prints both. Note that P and Q are the same. This is because they are sharing the same linked representation. This is because the Adjust procedure does not make a duplicate of the linked structure. Your task is to write the code for Adjust. Remove the "--" comment from the assignment statement at the beginning of Adjust, remove the null statement in Adjust, then write the procedure. You will know that you have written it correctly when the last output of Q does not contain the
           5.00000E00 x^2 
term. GOOD LUCK.

Due Date: You must complete this laboratory assignment by 12 midnight Sunday February 25, 1996. NO EXCEPTIONS, NO EXCUSES. If you wait until the last minute and the system is down, the grade is "0".

What to Submit: Cut and paste your Adjust Procedure into an email message and send it to me.

Dr. Beidler's Home Page Course Directory Top of Page

Lab 5: Writing A Finalize Procedure

Assignment:Use your result from Lab 4 and write the Finalize procedure. This is a tough one because it is difficult for you to know whether or not you wrote it correctly.

Due Date: You must complete this laboratory assignment by 12 midnight Sunday March 3, 1996. NO EXCEPTIONS, NO EXCUSES. If you wait until the last minute and the system is down, the grade is "0".

What to Submit: Cut and Paste your Finalize procedure into an email message and send it to me.

Dr. Beidler's Home Page Course Directory Top of Page

Lab 6: Working with an Iterator

Assignment:In this lab, you will construct the procedure that is passed to an iterator. The procedure uses text_IO to print the value in the single object passed to the procedure by the iterator.

To perform this lab you will be using the polymorphic stack package, which is already available on the Suns, or you can ftp the complete set of polymorphic data structures to your machine from ftp.cs.uofs.edu from the pub/Ada subdirectory. To perform this lab you need three resources,

The poly_Paren procedure reads a string and checks for correct matching of parentheses types, { to }, [ to ], and ( to ). Other symbols may appear in the string. This procedure reads the string and checks for the match. However, every time it sees an 'x' it calls the iterator to print the contents of the stack. To illustrate, here is a sample dialog with the program:

Enter any string - checks for proper parenthesis matching
  ([({()})((aa))]) would be accepted, but (())) would not
Enter Paren string: [[[x(((x[x]))x)]x]x]x
                        Stack top-to-bottom = [[[
                            Stack top-to-bottom = ((([[[
                              Stack top-to-bottom = [((([[[
                                  Stack top-to-bottom = ([[[
                                     Stack top-to-bottom = [[
                                       Stack top-to-bottom = [
                                         Stack top-to-bottom = 
                                         ACCEPTED

I'd suggest you do the following:

Due Date: You must complete this laboratory assignment by 12 midnight Sunday March 10, 1996. NO EXCEPTIONS, NO EXCUSES. If you wait until the last minute and the system is down, the grade is "0".

What to Submit: Email to me poly_paren_pak.adb

Dr. Beidler's Home Page Course Directory Top of Page

Lab 7: Binary Search Tree Lab

Assignment:Complete the code for a binary search tree algorithm. Also, the program contains two functions that find the longest path in the tree and the shortest path to a terminal node. You must complete the code in those two functions as well. Resources: To solve this problem you need four files

Description:In this lab you will complete three subprograms in bin_search_tree.adb as follows:

Due Date: You must complete this laboratory assignment by 12 midnight Sunday April 21, 1996. NO EXCEPTIONS, NO EXCUSES. If you wait until the last minute and the system is down, the grade is "0".

What to Submit: bin_search_tree.adb

Dr. Beidler's Home Page Course Directory Top of Page

Lab 8: AVL Restructuring Lab

Assignment:Complete the AVL restructuring in avl_tree.adb.

Resources: Use the avl_support package and random.dat file from the previous Lab. assignment. Bring avl_tree.adb into your account. It contains the same "--<<" tags to the locations you must modify, as the previous Lab

Description: Do the following:

What to submit Email the avl_tree procedure. Also include in your email message the values returned by the longest and shortest path procedures.

Due Date: You must complete this laboratory assignment by 12 midnight Sunday April 27, 1996. NO EXCEPTIONS, NO EXCUSES. If you wait until the last minute and the system is down, the grade is "0".

What to Submit: Cut and Paste your Finalize procedure into an email message and send it to me.

Dr. Beidler's Home Page Course Directory Top of Page

Dr. Beidler's Home Page Course Directory Top of Page
The GWU Lab

You will be participating in a doctoral research experiment at George Washington University. Details of you participation will be placed here shortly.

Due Date: Probably midnight Sunday May 5, 1996

Dr. Beidler's Home Page Course Directory Top of Page

Programming Assignments

Assignment # 1 - Merge of two linearly linked structures

Goal:

Assignment:Complete the code in link_merge. The program contains a procedure to create two linked structures, each structure contains twenty random numbers. The software system also contains a procedure that either prints the symbol "<>" when the list is null, or prints the numbers in the records in the order in which they appear in the linear structure, from first to last. Your task it to complete the software system so that the output produced by the five calls to the printing procedure demonstrate that the original sets in the two lists are ordered, then after the call to the merge procedure that you complete, the three remaining calls demonstrate that the two original lists had been emptied and that the third list contains the complete set of values properly merged.

To obtain the resources you need to complete this task,

Due Date: You must complete this laboratory assignment by midnight Wednesday February 21, 1996. NO EXCEPTIONS, NO EXCUSES. If you wait until the last minute and the system is down, the grade is "0".

What to Submit: Note how the initial source code contains in-line comments. Place similar and meaningful comments along with your code. Send me two email messages:

Dr. Beidler's Home Page Course Directory Top of Page

Tests

There will be two tests before the break, tentatively scheduled for February 14th and March 6th. There will be one or two tests after the break and a final exam.

Grades

I compute grades by using a weighted average. Specifically, each item is given a maximum possible grade, Mi , and a weighht, Wi. Given your grade for an assignment or test, Gi, the effective grade for that assignment is Wi*Gi/Mi. Your final grade is computed as

[Sum of Wi*Gi/Mi]/[Sum of Wi]

This computation produces a value in a standardized range. I reserve the right to determine the correspondence between these values and letter grades.

The Border Crossing Problem

The Border Crossing Problem is described in Section 8.6 of the notes. Your task is to carry out the solution described in that section. To get you started, a piece of code to read the border information has been supplied, as well as a data set thaht contains the border information for a map of the forty eight contiguous United States. These files are:

Compile. link and run map.adb before you get started. You may want to take a look at how it works. Impliment the solution to the border crossing problem as described in Section 8.6. Your program should accept two two-letter string abbreviations for the names of states, solve the problem, and print a solution path.

DUE DATE: By noon on Friday May 17, 1996, email me a copy of your program.

Dr. Beidler's Home Page Course Directory Top of Page

Sorting Out Sorts

Exercise 6 in Section 11.4 of the notes describe the results when five sets of data are run through three sort procedures. Write a paper describing your analysis of the five data sets and the three sort procedures that were used. One data set is the numbers in order, one is the numbers in reverse order, one are all the same, one random, and one where each number is almost where it belongs. Your task is to try and decide which set is which, and what are the three sort techniques that were used.

Write your analysis of the data sets. You may assume that one sort is an O(n^2) sort, and one is an O(n log n) sort. A good start would be to draw a line graph of the data as a starting point.

Your analysis must be word processed, double spaced. Please place your name in the upper left corner of each page and "Cmps 240" in the upper right corner. Include in your submission your line graphs.

DUE by noon Friday, May 17th

Dr. Beidler's Home Page Course Directory Top of Page

Dr. Beidler's Home Page Course Directory Top of Page