From 14fd8c7821f9bed6566638bd68526310263e8ea0 Mon Sep 17 00:00:00 2001 From: Ashwek Swamy <39827514+ashwek@users.noreply.github.com> Date: Tue, 23 Oct 2018 18:42:36 +0530 Subject: [PATCH] Update Bubble Sort.cpp reduced the number of iteration done be inner for loop used for sorting to improve efficiency. --- Sorting/Bubble Sort.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/Sorting/Bubble Sort.cpp b/Sorting/Bubble Sort.cpp index c94a45efc..7d79f78e7 100644 --- a/Sorting/Bubble Sort.cpp +++ b/Sorting/Bubble Sort.cpp @@ -3,27 +3,24 @@ #include using namespace std; -int main() -{ - int n; +int main(){ + int n, temp; + cout<<"Enter size of Array = "; cin >> n; - int Array[n]; - cout<<"\nEnter any 6 Numbers for Unsorted Array : "; + int *Array = new int[n]; + cout<<"\nEnter any " <