Binary Tree ADT implementation

  • Durum: Closed
  • Ödül: $15
  • Alınan Girdiler: 1

Yarışma Özeti

AIM
Build an implementation of a binary-tree ADT and Use it to evaluate an arithmetic expression which (for the sake of simplicity) includes only binary operations. JAVA is to be used as a programming language.

Problem Description
1. The purpose of the exercise is to practice building and traversing an expression tree; so I want you to build a tree to hold the expression and to evaluate the expression by traversing the tree. If you have another idea about how to evaluate the expression without building the expression tree, I encourage you to reconsider.

2. Please use the following syntax for the arithmetic expressions that I want you to process:
<expression> ::= <term> | <term> + <expression> | <term> - <expression>
<term> ::= <factor> | <factor> * <term> | <factor> / <term>
<factor> ::= <constant> | ( <expression> )
<constant> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
You can make it slightly more complex by allowing greater integers than 9 but you can let your constants range from 0 to 9 only.

3. Make sure you understand how this syntax defines operator precedence and associativity rule. Operator precedence: 3*5+4 is interpreted as (3*5)+4 rather than 3*(5+4). associativity rule: 3-5-4 is interpreted as 3-(5-4) rather than (3-5)-4.

4. Supply a two pager technical description of the program you wrote (this can be kept for later, if you win the contest)

5. Please write the code well commented

Tavsiye Edilen Beceriler

Bu yarışmadan başlıca girdiler

Daha Fazla Katılım Görüntüle

Genel Açıklama Panosu

  • abdou93
    abdou93
    • 2 yıl önce

    i can do it with stacks only without using trees

    • 2 yıl önce
    1. abdou93
      abdou93
      • 2 yıl önce

      i know that but stacks more simple for that task

      • 2 yıl önce
    2. Gangwani
      Yarışma Sahibi
      • 2 yıl önce

      the idea was used to show an implementation of tree and not to chose the simpler one between tree and stacks

      • 2 yıl önce
  • zain010
    zain010
    • 2 yıl önce

    #guaranteed please

    • 2 yıl önce
    1. Gangwani
      Yarışma Sahibi
      • 2 yıl önce

      Well you are the only one as of now, so chances for winning are high!

      • 2 yıl önce

Daha fazla yorum göster

Yarışmalara nasıl başlanır

  • Projenizi ilan edin

    Yarışmanızı İlan Edin Hızlı ve kolay

  • Tonlarca girdi alın

    Tonlarca Girdi Alın Bütün dünyadan

  • En iyi girdiyi seçin

    En iyi girdiyi seçin Dosyaları indirin - Kolay!

Şimdi bir Yarışma İlan Et ya da Bugün Bize Katılın!