+ - 0:00:00
Notes for current slide
Notes for next slide

CSCI-UA 102

Data Structures


BST - Implementation

Instructor: Joanna Klukowska


Copyright 2020 Joanna Klukowska. Unless noted otherwise all content is released under a
Creative Commons Attribution-ShareAlike 4.0 International License.
Background image by Stewart Weiss

1/4

What does this tree look like?

tree.add("salmon");
tree.add("flounder");
tree.add("grouper");
tree.add("cod");
tree.add("carp");
tree.add("tilapia");
tree.add("catfish");
tree.add("bluefish");
tree.add("tuna");
tree.add("yellowtail");
tree.add("herring");
tree.add("sturgeon");

With your group, draw out the tree that results from the above sequence of add operations. Assume you start with an empty tree.

Use Google Jamboard to draw it in a collaborative way. Use the name
"breakout room NUM" in which you replace NUM with the number of your breakout room. Share it with jk157@nyu.edu as well as all your room members.

2/4

What is this?

salmon
|--flounder
|--cod
|--carp
|--bluefish
|--->
|--->
|--catfish
|--->
|--->
|--->
|--grouper
|--->
|--herring
|--->
|--->
|--tilapia
|--sturgeon
|--->
|--->
|--tuna
|--->
|--yellowtail
|--->
|--->

Try to answer the following questions:

  • what does the drawing on the left represent?
  • how does it relate to the tree that you drew in the previous step?
  • can you come up with an algorithm that produces that kind of output given a binary search tree?



When we come back to the main room, some rooms will get a chance to answer these questions, so make sure you can explain your answers.

3/4

WARNING: you will not be able to start this part until after we discuss the previous parts in the main room.

Implement the add

  • One person in your room should open the Ed workspace that contains the skeleton for the BST class. That person should share the workspace with the other members of the room and with jk157@nyu.edu. Do not make it public.

  • Rename your workspace BST-breakout-NUM in which you replace NUM with the number of your workspace.

  • Implement the add method using a recursive approach. This should be collaborative work and discussion, not parallel development. Decide what needs to be checked and how things should be validated. Make sure that you think of any special cases (for example, adding to an empty tree or adding a duplicate of an existing value).

When we come back to the main room, some rooms will get a chance to showcase their code so make sure you keep it presentable.

4/4

CSCI-UA 102

Data Structures


BST - Implementation

Instructor: Joanna Klukowska


Copyright 2020 Joanna Klukowska. Unless noted otherwise all content is released under a
Creative Commons Attribution-ShareAlike 4.0 International License.
Background image by Stewart Weiss

1 / 4

What does this tree look like?

tree.add("salmon");
tree.add("flounder");
tree.add("grouper");
tree.add("cod");
tree.add("carp");
tree.add("tilapia");
tree.add("catfish");
tree.add("bluefish");
tree.add("tuna");
tree.add("yellowtail");
tree.add("herring");
tree.add("sturgeon");

With your group, draw out the tree that results from the above sequence of add operations. Assume you start with an empty tree.

Use Google Jamboard to draw it in a collaborative way. Use the name
"breakout room NUM" in which you replace NUM with the number of your breakout room. Share it with jk157@nyu.edu as well as all your room members.

2 / 4

What is this?

salmon
|--flounder
|--cod
|--carp
|--bluefish
|--->
|--->
|--catfish
|--->
|--->
|--->
|--grouper
|--->
|--herring
|--->
|--->
|--tilapia
|--sturgeon
|--->
|--->
|--tuna
|--->
|--yellowtail
|--->
|--->

Try to answer the following questions:

  • what does the drawing on the left represent?
  • how does it relate to the tree that you drew in the previous step?
  • can you come up with an algorithm that produces that kind of output given a binary search tree?



When we come back to the main room, some rooms will get a chance to answer these questions, so make sure you can explain your answers.

3 / 4

WARNING: you will not be able to start this part until after we discuss the previous parts in the main room.

Implement the add

  • One person in your room should open the Ed workspace that contains the skeleton for the BST class. That person should share the workspace with the other members of the room and with jk157@nyu.edu. Do not make it public.

  • Rename your workspace BST-breakout-NUM in which you replace NUM with the number of your workspace.

  • Implement the add method using a recursive approach. This should be collaborative work and discussion, not parallel development. Decide what needs to be checked and how things should be validated. Make sure that you think of any special cases (for example, adding to an empty tree or adding a duplicate of an existing value).

When we come back to the main room, some rooms will get a chance to showcase their code so make sure you keep it presentable.

4 / 4

What does this tree look like?

tree.add("salmon");
tree.add("flounder");
tree.add("grouper");
tree.add("cod");
tree.add("carp");
tree.add("tilapia");
tree.add("catfish");
tree.add("bluefish");
tree.add("tuna");
tree.add("yellowtail");
tree.add("herring");
tree.add("sturgeon");

With your group, draw out the tree that results from the above sequence of add operations. Assume you start with an empty tree.

Use Google Jamboard to draw it in a collaborative way. Use the name
"breakout room NUM" in which you replace NUM with the number of your breakout room. Share it with jk157@nyu.edu as well as all your room members.

2 / 4
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow
+ -
Notes for current slide
Notes for next slide
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow