Загрузка страницы

Find an element in a sorted rotated array

Problem:
Given a sorted integer array which is rotated any number of times and an integer num, find the index of num in the array.
If not found, return -1.

Solution:
1: Find index of pivot element (minimum element).
2: If num lies between start element and element at pivot-1 position, then find num in array[start…pivot-1] using binary search.
3: Else if num lies between pivot and last element, then find num in array[pivot…end] using binary search.

Code and Algorithm Visualization: http://www.ideserve.co.in/learn/find-an-element-in-a-sorted-rotated-array

Binary Search Playlist: https://www.youtube.com/playlist?list=PLamzFoFxwoNhR2uFoqm6nr8VgsERgTmYy

Website: http://www.ideserve.co.in

Facebook: https://www.facebook.com/IDeserve.co.in

Видео Find an element in a sorted rotated array канала IDeserve
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
26 августа 2015 г. 22:53:12
00:07:09
Яндекс.Метрика