CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 27: Review – most children and truth about cons.

Slides:



Advertisements
Similar presentations
AVL Trees When bad trees happen to good programmers.
Advertisements

ECE 3110: Introduction to Digital Systems Chapter 6 Combinational Logic Design Practices XOR, Parity Circuits, Comparators.
AB 11 22 33 44 55 66 77 88 99 10  20  19  18  17  16  15  14  13  12  11  21  22  23  24  25  26  27  28.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 4: Review Conditional & Word Stuff.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 17: HOF and Tick-Tack-Toe.
CS 171: Introduction to Computer Science II
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 18: HOF.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 26: Printing and Stuff.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 14: Number Spelling Mini-project.
CS2420: Lecture 13 Vladimir Kulyukin Computer Science Department Utah State University.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 12: Homework stuff and Accumulating Recursion.
Things to look forward to… There is a quiz coming up. – On what I’m about to show you Presentations remaining – Kevin – Richard – Colleen – Michael Drop.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 19: HOF Problems.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 6: Mini-Project Prep.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 10: Recursion Rocks Again!
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 13: Bugs and Two Stage Recursion.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 20: Tree Recursion.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 1: Introduction & Administration.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 11: Accumulating Recursion.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 8: Recursion.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 9: Recursion Rocks!
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 2: Review – Writing Procedures.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 16: Let and Lambda.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 25: Trees and Generalized Lists.
4.8 Huffman Codes These lecture slides are supplied by Mathijs de Weerd.
Quiz: Box and Pointer fun! (cons (cons (cons ‘hey (cons ‘there nil)) nil) (cons ‘wow nil)) (list ‘boo (append (list ‘hoo ‘hoo) (cons ‘see ‘me)))
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 7: Review.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 15: Procedures as Arguments.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 5: Difference Between Dates Case Study.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 24: Review for lists, map and member.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 3: Conditional Expressions.
1-2 Linear Measure Textbook page 13. Review: Measuring with a ruler Find the length of using each ruler. cm in.
4.8 Huffman Codes These lecture slides are supplied by Mathijs de Weerd.
Lecture # 9 Chap 4: Ambiguous Grammar. 2 Chomsky Hierarchy: Language Classification A grammar G is said to be – Regular if it is right linear where each.
Announcements Exam Friday. More Physical Storage Lecture 10.
Multiplexers. Functional Description and Symbols.
Getting Direction – Map it Out! Today’s Goal: To learn the basics of using a map. This will include learning the definition of a map legend, identifying.
too.
Problem of the Day  Solve this equation by moving the numbers: 76 = 24.
Discrete Mathematics Chapter 5 Trees.
Foundation of Computing Systems
Tim Roughgarden Introduction Merge Sort (Analysis ) Design and Analysis of Algorithms I.
CHAPTER 11 TREES INTRODUCTION TO TREES ► A tree is a connected undirected graph with no simple circuit. ► An undirected graph is a tree if and only.
Week 7 - Wednesday.  What did we talk about last time?  Recursive running time  Master Theorem  Symbol tables.
CS61A Lecture Colleen Lewis. Clicker poll Where do you think you’re learning the most? I assume you’ll learn the most in lab & disc (so.
CS61A Lecture Colleen Lewis. Clicker Test When do you think homework should be due? A)10pm B)11pm C)Midnight D)11am the next day.
CS 152: Programming Language Paradigms April 7 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak
Chapter 6 – Trees. Notice that in a tree, there is exactly one path from the root to each node.
Adversarial Search In this lecture, we introduce a new search scenario: game playing 1.two players, 2.zero-sum game, (win-lose, lose-win, draw) 3.perfect.
03/12/13 Trees and CFGs Discrete Structures (CS 173) Derek Hoiem, University of Illinois 1.
Logic Gates, Boolean Algebra and Karnaugh Maps. Challenge! By the end of todays session can you complete the following?
Introduction to Automata Theory Theory of Computation Lecture 6 Tasneem Ghnaimat.
1 Recursive Data Structures CS 270 Math Foundations of CS Jeremy Johnson.
4.8 Huffman Codes These lecture slides are supplied by Mathijs de Weerd.
Logic Gates, Boolean Algebra and Karnaugh Maps
ISNE101 – Introduction to Information Systems and Network Engineering
CHAPTER 4 Trees.
Hire Toyota Innova in Delhi for Outstation Tour
Lecture #8 מבוא מורחב.
Binary Tree Traversals
Lecture 36 Section 12.2 Mon, Apr 23, 2007
CS 457/557: Functional Languages Folds
CS 140 Lecture Notes: Introduction
List and list operations (continue).
Lecture # , , , , מבוא מורחב.
CS 140 Lecture Notes: Introduction
Parallel, Parallel, Parallel ||
Goals Design decisions Design Insertion
Lines, rays and line segments
Lecture 8: Recursing Lists CS150: Computer Science
Presentation transcript:

CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 27: Review – most children and truth about cons

Today Generalized List Recursion The truth about cons

most-children (define (number-of-most-children tree) (if (leaf? tree) 0 (reduce max (cons (length (children tree)) (map number-of-most-children (children tree) ) ) ) ) )

most-children A CB FDD

The truth about cons (cons ‘B ‘() )  ‘(B) B‘() carcdr

The truth about cons (cons ‘A ‘(B) )  ‘(A B) A carcdr B‘() carcdr

The truth about cons (cons ‘A ‘(B C D) )  ‘(A B C D) A carcdr B carcdr C carcdr D‘() carcdr

The truth about cons (cons ‘(A) ‘(B) )  ‘((A) B) carcdr B‘() carcdr A‘() carcdr

The truth about cons (cons ‘A ‘B)  ‘(A. B) AB carcdr