From 527dfecbe57daa1674d410617424e80fd632112c Mon Sep 17 00:00:00 2001 From: Sajal-24-jain <96467219+Sajal-24-jain@users.noreply.github.com> Date: Wed, 26 Oct 2022 01:02:48 +0530 Subject: [PATCH] Create Rotate Array.cpp --- Rotate Array.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Rotate Array.cpp diff --git a/Rotate Array.cpp b/Rotate Array.cpp new file mode 100644 index 00000000..2da49c9b --- /dev/null +++ b/Rotate Array.cpp @@ -0,0 +1,61 @@ +#include +using namespace std; + + +void leftRotateByD(int *arr,int n,int d) +{ + + int temp[d]; + for (int i=0;i>n; + + int arr[n]; + cout<<"Enter the elements of array\n"; + for (int i=0;i>arr[i]; + } + + cout<<"Enter the value of D\n"; + cin>>d; + + /* function call to rotate the array */ + leftRotateByD(arr,n,d); + + cout<<"Array after left rotation by D places\n"; + for (int i=0;i