CaptionsMaker
.com
9 Searching in a Nearly Sorted Array
Edit Subtitles
Download Subtitles
SRT
TXT
Title:
Description:
SEARCH IN A NEARLY SORTED ARRAY: Given an array which is sorted, but after sorting some elements are moved to either of the adjacent positions, i.e., arr[i] may be present at arr[i+1] or arr[i-1]. Write an efficient function to search an element in this array. Basically the element arr[i] can only be swapped with either arr[i+1] or arr[i-1]. For example consider the array {2, 3, 10, 4, 40}, 4 is moved to next position and 10 is moved to previous position. Example : Input: arr[] = {10, 3, 40, 20, 50, 80, 70}, key = 40 Output: 2 Output is index of 40 in given array PROBLEM STATEMENT LINK:https://www.geeksforgeeks.org/search-almost-sorted-array/ PLAYLIST LINK:https://www.youtube.com/playlist?list=PL_z_8CaSLPWeYfhtuKHj-9MpYb6XQJ_f2
YouTube url:
https://youtu.be/W3-KgsCVH1U
Created:
7. 12. 2021 14:24:35