MCPcopy Create free account
hub / github.com/SR-Sunny-Raj/Hacktoberfest2021-DSA / convertToWave

Method convertToWave

04. Arrays/Wave Array.cpp:11–22  ·  view source on GitHub ↗

arr: input array n: size of array Function to sort the array into a wave-like array.

Source from the content-addressed store, hash-verified

9 // n: size of array
10 //Function to sort the array into a wave-like array.
11 void convertToWave(vector<int>& arr, int n){
12 for(int i=0;i<n-1;i++){
13
14 int temp=arr[i+1];
15 arr[i+1]=arr[i];
16 arr[i]=temp;
17 i++;
18 //cout<<arr[i]<<" ";
19 }
20
21
22 }
23};
24
25// { Driver Code Starts.

Callers 1

mainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected