Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Draw a binary search tree which has the following values: 4, 6, 11, 22, 53, 94, 21, 53. You can place the nodes anywhere

image text in transcribed

1. Draw a binary search tree which has the following values: 4, 6, 11, 22, 53, 94, 21, 53. You can place the nodes anywhere as you d like as long as it's a BSI Select one of the leaves of the BST you've drawn above. Next show how the contains algorithm from the TreesLecture.pdf, which we studied, goes through its execution on your BST to find the leaf node you've selected. Show the root node method call and subsequent recursive calls until you reach the value. Alongside your recursive call stacks, over the BST drawing, trace the path the contains method follows. (20 points) 2. Write an algorithm (in as close to Java code as possible) which has a runtime of (nlogn). Your algorithm must use a stack somehow. Explain what your algorithm does/its purpose/its parameters/what it returns. (20 points) 3. (n2). Write an algorithm (in as close to Java code as possible) which has a runtime of Your algorithm must use a queue and manipulate a String (somehow, it's completely up to you). Explain what your algorithm does/its purpose/its parameters/what it returns. (20 points) 1. Draw a binary search tree which has the following values: 4, 6, 11, 22, 53, 94, 21, 53. You can place the nodes anywhere as you d like as long as it's a BSI Select one of the leaves of the BST you've drawn above. Next show how the contains algorithm from the TreesLecture.pdf, which we studied, goes through its execution on your BST to find the leaf node you've selected. Show the root node method call and subsequent recursive calls until you reach the value. Alongside your recursive call stacks, over the BST drawing, trace the path the contains method follows. (20 points) 2. Write an algorithm (in as close to Java code as possible) which has a runtime of (nlogn). Your algorithm must use a stack somehow. Explain what your algorithm does/its purpose/its parameters/what it returns. (20 points) 3. (n2). Write an algorithm (in as close to Java code as possible) which has a runtime of Your algorithm must use a queue and manipulate a String (somehow, it's completely up to you). Explain what your algorithm does/its purpose/its parameters/what it returns. (20 points)

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

More Books

Students also viewed these Databases questions

Question

What will you do or say to Anthony about this issue?

Answered: 1 week ago