Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(8 Points) Assume that the letters of your first name and last name are inserted into a binary search tree (duplicates are allowed and values

  1. (8 Points) Assume that the letters of your first name and last name are inserted into a binary search tree (duplicates are allowed and values less than or equal to current node will be on its left side) where each letter is inserted into a sperate node. Show how will your name look like in the following cases:
    1. If the tree is traversed in an Preorder traversal
    2. If the tree is traversed in an Postorder traversal
    3. If the tree is traversed in an inorder traversal
  2. (6 Points) For each of the following methods, write the time complexity in the cases below the method description.
    1. The method: boolean contains(E e) which return true or false depending on whether a particular object is a member of a collection.
      • Case1: the data structure is Sorted list implemented with an array:
      • Case 2: the data structure is Sorted list implemented a with linked list:
      • Case 3: the data structure is Binary search tree:
    2. The method: boolean insert(E e, int index): add a new item to the collection in the appropriate place.
      • Case 1: the data structure is Unsorted list implemented with an array:
      • Case 2: the data structure is Sorted list implemented with an array:
      • Case 3: the data structure is Binary search tree:

please help ; in java language

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

Students also viewed these Databases questions

Question

How do post-tax deductions differ from pre-tax deductions?

Answered: 1 week ago