Binary Search in Trees


Problems 1

Problem : Write a function that will perform a binary search on a sorted array of integers.


Problem : Assume now that we modify the definition of a binary search tree slightly. All of the data in a left subtree must precede the data in the current node, but all of the data in the right subtree must only be greater than or equal to the data in the root node (as opposed to exclusively greater than). Write a function that will take a new binary search tree and return 1 or 0 for whether it contains any duplicates.


Problem : What is the worst case scenario for a binary search tree in terms of the complexity for searching for a data element? What about for adding a new data element?


Take a Study Break

SparkLife

Star Trek gets SEXY

Chris Pine and Zoe Saldana heat up the red carpet!

SparkLife

Are you afraid of relationships?

Auntie SparkNotes can help!

SparkLife

Wanna get JLaw's gorgeous glow?

Click here for simple, sexy makeup tricks!

SparkLife

Sexy starlet style

See every single look from the Met Gala!

SparkLife

Who'd be on your zombie-apocalypse crew?

We already dib'sed Genghis Khan.

Geek out!

The MindHut

Geeky Actors: Then and Now

Travel back in time!

The MindHut

Villains We Want These Actresses to Play

From super cute to super bad!

The MindHut

10 Movies Better Than Their Books

What do you think?

The MindHut

How To Look Like J-Law...

When you don't look like J-Law.

The MindHut

12 Scientific Inaccuracies in Into Darkness

What did Star Trek get wrong?

The Book

Cover image

Read What You Love, Anywhere You Like

Get Our FREE NOOK Reading Apps