Рет қаралды 6,067
Source Code: thecodingsimpl...
Solution
Sort the given array
Now take variable start, end, mid
Get middle element & create node using value present at this index
Now recursively call value from start to mid - 1 in left side & mid + 1 to end in right side
At last return the node
Time Complexity: O(nlogn), if array is sorted then Time complexity will be O(n)
Space Complexity: O(1)
For more info, please see the video.
CHECK OUT CODING SIMPLIFIED
/ codingsimplified
★☆★ VIEW THE BLOG POST: ★☆★
thecodingsimpli...
I started my KZbin channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 500+ videos.
★☆★ SUBSCRIBE TO ME ON KZbin: ★☆★
www.youtube.co...
★☆★ Send us mail at: ★☆★
Email: thecodingsimplified@gmail.com