There is no doubt about the fact that as time is changing day by day, technology is also changing at a very fast pace. Every day a new technology came into the picture that’s why this is going to be very urgent to be updated every second, and people from different places of the earth must keep hooked to it. Although, there is a variety of tech influencers or tech bloggers in India that have expertise in their technical domain and they are really worthy to appreciate for their work, throughout the country. Technology has transformed our lives completely different from before. This niche is really has attracting nature across different spheres throughout the globe. Well, if you came here while searching for the best Indian technical blog so, we have a deep discussion on the best tech blogs TechGecs , whose owner Ashish Pratap Singh updates his tech blog regularly. What makes the TechGecs outstanding in terms of performance and rank, is their approach and sense of understanding in t
You have given a sorted array a[ ] of distinct integers and you have to sort the array in a wave-like pattern. It will be arranged like a[0]>=a[1]<=a[2]>=a[3]<=a[4]... This question has been asked in Google, Microsoft, Adobe, Amazon, Goldman Sachs, Paytm , and FactSet . Input: n=5 a[ ] = {1, 2, 3, 4, 5} Output: 2 1 4 3 5 So how can we solve this problem? If our array is already sorted then we have to just swap the array at the alternate elements. Like for a[ ] = {1, 2, 3, 4, 5} Loop1: i=0, a[ ] = {2, 1, 3, 4, 5} Loop2: i=2, a[ ] = {2, 1, 4, 3, 5} for Loop 3: i=4 which is not less than n-1 i.e. 4. So the loop ends here. The array generated is forming a wave pattern: {2, 1, 4, 3, 5}. Cpp code: #include <bits/stdc++.h> using namespace std ; int main () { int n; cin >> n; int a[n]; for ( int i = 0 ; i < n; i ++ ) cin >> a[i]; for ( int i = 0 ; i < n - 1 ; i += 2 ) { swap (a[