abhishekdoifode1 / Hacktoberfest2021

This Repo is created by Abhishek for the beginners to promote open source programming (hacktoberfest), you just need to add any type of code in any programing lang you want, just commit your name at the end. Give a Star⭐
130 stars 665 forks source link

Create ArchitPorwal_Wave_sort.cpp #980

Closed porwalarchit closed 2 years ago

porwalarchit commented 2 years ago

Optimised Code

Accepts User Input

Traverse all even positioned elements of input array, and do following.

 a) If current element is smaller than previous odd element, swap previous and current. 
 b) If current element is smaller than next odd element, swap next and current.