ISTE-VIT / The-CP-Companion

Your ultimate destination for Competitive Coding this Hacktoberfest21
18 stars 74 forks source link

The CP Companion - search and sort - C++ #190

Closed Rashi-maru closed 2 years ago

Rashi-maru commented 2 years ago

The CP Companion - search and sort - C++ Nearly sorted array Problem Statement- 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]. Screenshot (4087)