Programming Assignment #5 -- Binary Trees

Programming Assignment #5 -- Binary Trees

Programming Assignment #5 Binary Trees CS-2301, System Programming for Non-Majors (Slides include materials from The C Programming Language, 2nd edition, by Kernighan and Ritchie and from C: How to Program, 5th and 6th editions, by Deitel and Deitel) CS-2301, B-Term 2009 Binary Trees 1 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: Friday, December 4, 2009, 11:59 PM

CS-2301, B-Term 2009 Binary Trees 2 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 CS-2301, B-Term 2009 Binary Trees 3 By the End of this Assignment

you should start feeling confident that You can write a non-trivial C program for any course assignment at WPI You are capable of learning the things you dont know on your own You are beginning to think computationally with respect to collecting and organizing data CS-2301, B-Term 2009 Binary Trees 4 What is a Binary Tree? Previous lecture topic See also 6.5 of Kernighan & Ritchie CS-2301, B-Term 2009 Binary Trees 5

Your Program Multiple files as in previous programming assignments Of your own organization makefile to build it or Visual Studio Algorithms from K & R or any other s! ! d a n i e d ipfrei r k u

i o yW n e resources v E Cite your resources! CS-2301, B-Term 2009 Binary Trees 6 Command Line of Your Program ./PA5 outputFile inputFile1 inputFile2 ... CS-2301, B-Term 2009 Binary Trees 7

Sample Output (written to outputFile) 166 a 25 and 11 as 3 command 15 each 2 file 4 files 109 in 4 input 98 it

99 of 3 open 6 program 18 read 152 the 41 this 3 under 30 would ------------17 Total number of different words CS-2301, B-Term 2009 Binary Trees 8

makefile or Visual Studio For building your program Note: we dont know what the file names ofreyour it. d ton c w a r o o t h ex program components are rnab #6 s a t e n

l i tod in L line po e d e v i e e d F know m! nodwhat c maneeds n a u l Only you (and your makefile) r l

i g w tr ro Yooube ivnide ecro2m. your p T procemb ts to to be built and how n Dergume a If you are feeling adventurous Build and debug in Visual Studio instead Use Visual Studio project files Clean your project before submitting Zip your files together for submission CS-2301, B-Term 2009

Binary Trees 9 Write-up Description of your program, the .c files, .h files, etc. Pre- and post-conditions of all recursive functions Loop invariants of critical loops Description of your data structure and the principal functions Citation of resources and algorithms CS-2301, B-Term 2009 Binary Trees 10 Submitting Your Project Use /cs/bin/turnin submit cs2301 PA5 ...

Submit: Write-up .c files, .h files, and makefile or Clean, zipped version of Visual Studio project directory Sample output CS-2301, B-Term 2009 Binary Trees 11 Questions? CS-2301, B-Term 2009 Binary Trees 12

Recently Viewed Presentations

  • Task shifting: field experience and current thinking within MSF

    Task shifting: field experience and current thinking within MSF

    Task shifting & HRH Crisis: field experience and current thinking within MSF Mit Philips, Médecins Sans Frontières, Brussels. WHO satelite conference, Kigali June 2007
  • Welcome to the WinHEC Online

    Welcome to the WinHEC Online

    Can be provided by a different company and updated independently from the base INF. Looks the same as a base INF, but extends the base INF for customization or specialization. Enhances the value of the device, but is not necessary...
  • Measurement of b-tagging Fake rates in Atlas Data

    Measurement of b-tagging Fake rates in Atlas Data

    For the tagger performance we can not entirely rely on the MC due to the discrepancies between data and MC simulation. It is also important for the early running of the Atlas detector to measure the tagger performance and mistag...
  • Nuclear Stability - Oneonta

    Nuclear Stability - Oneonta

    Predict what you think the trend will be: As atomic number increases, what will happen to stability?
  • The SLO Cycle and Development - Connecticut

    The SLO Cycle and Development - Connecticut

    Though collecting macro-level data, you can capture a snapshot of multiple teaching condition constructs, which provides a holistic perspective of the quality of conditions at one or multiple schools. Macro-level analysis can be done two ways—first, through an anonymous survey...
  • Union Strategy - Michigan State University

    Union Strategy - Michigan State University

    Union Options for Resource Allocation Organizing Representation Political Action Internal Structure of Labor Movement in U.S. Central Labor Bodies AFL-CIO (52 Union) Federation of unions Does not bargain with employers supports efforts of affiliates Change to Win (established in 2005)...
  • Severe Weather Shelter Operations

    Severe Weather Shelter Operations

    Managing the volunteer shift sign-up software (called Homebase) Training volunteers on the Homebase software. Working with volunteers and Site Managers/Schedulers on shelter staffing. Training volunteers on Shelter Operations. Alerting citizens through email and texts when the shelter is activated
  • Effects of sympathomimetics outside cardiovascular system ...

    Effects of sympathomimetics outside cardiovascular system ...

    Activationofβ2-receptorsinsmoothmusculatureofbronchi. Healthy Liverpool. Results. in. bronchodilatation. That. is . why. are . β. 2-agonists. very. important. in ...