Presentation is loading. Please wait.

Presentation is loading. Please wait.

Homework #5, Binary Trees CS-2301 B-term 20081 Homework #5 Binary Trees CS-2301, System Programming for Non-majors (Slides include materials from The C.

Similar presentations


Presentation on theme: "Homework #5, Binary Trees CS-2301 B-term 20081 Homework #5 Binary Trees CS-2301, System Programming for Non-majors (Slides include materials from The C."— Presentation transcript:

1 Homework #5, Binary Trees CS-2301 B-term 20081 Homework #5 Binary Trees CS-2301, System Programming for Non-majors (Slides include materials from The C Programming Language, 2 nd ed., by Kernighan and Ritchie and from C: How to Program, 5 th ed., by Deitel and Deitel)

2 Homework #5, Binary Trees CS-2301 B-term 20082 Assignment Read in a series of text files Keep track of the number of occurrences of each word In the set of files you read Print out a list of words (in alphabetical order) and the number of times each occurs Due Date:– Sunday, December 14, 2008 11:59 PM

3 Homework #5, Binary Trees CS-2301 B-term 20083 Goals and Objectives Pull together a non-trivial program from resources and algorithms at your disposal Build up and use a massive data structure in the form of a binary tree One entry for each separate word encountered Each entry counts the number of instances of that word Create and write your output file

4 Homework #5, Binary Trees CS-2301 B-term 20084 By the End of this Assignment… … you should feel confident that –You can write a non-trivial C program for any course assignment at WPI –You are capable of learning the things you don’t know on your own –You are beginning to think “computationally” with respect to collecting and organizing data

5 Homework #5, Binary Trees CS-2301 B-term 20085 What is a Binary Tree? Next lecture topic See also §6.5 of Kernighan & Ritchie

6 Homework #5, Binary Trees CS-2301 B-term 20086 Your Program Multiple files as in Homework #4 Of your own organization makefile to build it Algorithms from K & R or any other resources Cite your resources!

7 Homework #5, Binary Trees CS-2301 B-term 20087 Your Program Multiple files as in Homework #4 Of your own organization makefile to build it Algorithms from K & R or any other resources Cite your resources! Even your friends!

8 Homework #5, Binary Trees CS-2301 B-term 20088 Your Program Multiple files as in Homework #4 Of your own organization makefile to build it Algorithms from K & R or any other resources Cite your resources! Even Wikipedia!

9 Homework #5, Binary Trees CS-2301 B-term 20089 Your Program Multiple files as in Homework #4 Of your own organization makefile to build it Algorithms from K & R or any other resources Cite your resources! Command line of your program:–./hw5 outputFilePath inputFilePath1 inputFilePath2...

10 Homework #5, Binary Trees CS-2301 B-term 200810 Sample Output (written to outputFilePath ) 166a 25and 11as 3command 15each 2file 4files 109in 4input 98it 99of 3open 6program 18read 152the 41this 3under 30would ------------- 17Total number of different words

11 Homework #5, Binary Trees CS-2301 B-term 200811 makefile For building your program Note:– we don’t know what the file names of your program components are Only you (and your makefile ) know what needs to be built and how

12 Homework #5, Binary Trees CS-2301 B-term 200812 Write-up Description of your program, the.c files,.h files, etc. Description of your data structure and the principal functions Citation of resources and algorithms

13 Homework #5, Binary Trees CS-2301 B-term 200813 Submitting Your Project Use /cs/bin/turnin submit cs2301 hw5... Submit:– Write-up.c and.h files makefile Sample output

14 Homework #5, Binary Trees CS-2301 B-term 200814 Extra Credit (25%) After you complete assignment! Modify copy of program to gather statistics about how many calls it takes to find a word in binary tree As a function of number of words in the tree Store results in another file Plot file in Excel or your favorite plotting program Logarithmic scale of # of words Print in PDF (or other portable format) and submit

15 Homework #5, Binary Trees CS-2301 B-term 200815 Questions?


Download ppt "Homework #5, Binary Trees CS-2301 B-term 20081 Homework #5 Binary Trees CS-2301, System Programming for Non-majors (Slides include materials from The C."

Similar presentations


Ads by Google