Programming Assignment 2

Programming Assignment 2

Programming Assignment 2A CMSC 331 Fall 2009 Due Thurs 11/19/09 Code the following [10 pts] Using the IntTree case class discussed during lecture write a method that sums the values in the nodes of the IntTree [15 pts] Write the following traversal methods (i.e of type Intree-> List[Int]) 1. 2. a) b) c)

3. 4. 5. Inorder Preorder Postorder [10 pts] Write a method that is like 2a except that it supports filtering. The method takes an additional argument that is a function of type Int->Boolean, if the function returns true when applied to a node then the the value at the node is filtered out of the resultant inorder list.

[5 pts] Generalize an IntTree so that the nodes can contain a value of any type T (all you need is the definition here) [10 pts] Write a method that allows you to apply a function of type T->S to the new class created in (4) to create a tree of Ss. Submission Instructions Put the answers to the questions in a script file Mail that script file to me at [email protected] with the subject line CMSC_331_P2A_FA_09

Recently Viewed Presentations

  • Contact Info: Bradley.Vasil@TEA.Texas.Gov (512) 463-6787 www.sli.do #2016 Contact

    Contact Info: [email protected] (512) 463-6787 www.sli.do #2016 Contact

    Contact Info: [email protected] (512) 463-6787. www.sli.do #2016. I know in the past Victoria Young gave this presentation and it was filled with detailed data and information.
  • UJI BEDA MEAN DAN BEDA PROPORSI - WordPress.com

    UJI BEDA MEAN DAN BEDA PROPORSI - WordPress.com

    Pearson chi Square: digunakan bila asumsi chi square terpenuhi (tidak boleh ada nilai expected < 1 dan nilai Expected < 5 lebih dari 20%), jika nilai expectasi yang terlalu kecil, akan mengakibatkan nilai Chi Square >> sehingga peluang menolak Ho...
  • Thinking and Language

    Thinking and Language

    Thinking and concepts. Without concepts, we would need a different name for every person, event, object, and idea. We could not just simply say, "They are angry."
  • CORE+ - University of Findlay

    CORE+ - University of Findlay

    Must take one additional course from the previous lists (C1, C2, C3, O1, O2, O3, R1, R2, R3, E1, or E2) above: Must select ONE course from the outcome above that has not already been taken. Example: If student took...
  • Programas Derechos Humanos- ESAP

    Programas Derechos Humanos- ESAP

    Advertencia Fuentes del Conocimiento . Fuentes del Conocimiento . Fuente = foin (lat.) lugar de donde emana algo. Origen del Conocimiento . El Proceso de la Investigación Científica.
  • Lifestyle - Miami Beach Senior High School / Overview

    Lifestyle - Miami Beach Senior High School / Overview

    ©2014 National Endowment for Financial Education | Lesson 3-4: Lifestyle. Transition into the lesson preview, noting the Learning Outcomes in the Student Learning Plan. By the end of this lesson, the students should be able to establish short-term and long-term...
  • NEW DEVELOPME NTS IN GLOBAL STANDARDS Group Discussion

    NEW DEVELOPME NTS IN GLOBAL STANDARDS Group Discussion

    Committee on Payment and Settlement Systems (CPSS) Financial Action Task Force (FATF) International Association of Deposit Insurers (IADI) International Association of Insurance Supervisors (IAIS) International Organization of Securities Commissions (IOSCO) All of the above equally. None of the above
  • Algebra &amp; Trigonometry 10th edition

    Algebra & Trigonometry 10th edition

    Algebra & Trigonometry 10th edition Subject: Section 2.1 The Distance and Midpoint Formulas ... Times New Roman Default Design 1_Default Design Chapter 2 PowerPoint Presentation Xy-Plane Some Plotted Points Quadrants TI-84 Plus C Standard Viewing Rectangle PowerPoint Presentation Distance ...