Skip to content

JontyMC/Math-Tree-F-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Binary Expression Tree - Coding Karta

Part A – 5 mins

Draw a representation the following formula as a binary tree

1 + 2 * 3

Part B – 2hrs

Write code that is unit tested that will

  • Produce the tree nodes necessary to represent the expression tree (30mins)
    • Use anonymous functions for the operations
    • Think polymorphism!
  • Build a binary tree by parsing the string representing the formula in part A (1hr)
  • Execute the operations and evaluate the tree by calling only the root tree node (1hr)

Part C – 2hrs

  • Draw a representation the following formula as a binary tree
  • Extend code developed in part A to allow the following expression to be evaluated

4 + 2 * 3 / 2 evaluates to 7

Part D – 5hrs

  • Watch the following video on Inheritance, Polymorphism & Testing (1hr)
  • Refactor your code so NO if, switch or new statements are used in objects that are used to define the binary tree. Objects for wiring (eg factories) may use if, switch or new statements

Part E – 3hrs

  • Make sure your code works with the following Test case expressions
    • 2+4+3 evaluates to 9
    • 2+4*3 evaluates to 14
    • 2/4*6 evaluates to 3
    • 2+4*3+5 evaluates to 19
    • 2+4*3-5 evaluates to 9
    • 3+45+73*5-9 evaluates to 119
    • 3+45+735-9/62+7 evaluates to 132
  • Practices
    • Binary tree structures
    • Polymorphism
    • SOLID
    • Anonymous functions
    • Unit tests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published