We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3726c0c + 0f6322d commit d712151Copy full SHA for d712151
insertalgo.py
@@ -0,0 +1,17 @@
1
+def insertionSort(arr):
2
+ n = len(arr)
3
+
4
+ if n <= 1:
5
+ return
6
7
+ for i in range(1, n):
8
+ key = arr[i]
9
+ j = i-1
10
+ while j >= 0 and key < arr[j]:
11
+ arr[j+1] = arr[j]
12
+ j -= 1
13
+ arr[j+1] = key
14
15
+arr = [12, 11, 13, 5, 6]
16
+insertionSort(arr)
17
+print(arr)
maxnum.cpp
@@ -0,0 +1,21 @@
+#include <bits/stdc++.h>
+using namespace std;
+void solve(){
+ int n;
+ cin>>n;
+ int arr[n];
+ for(int i=0;i<n;i++){
+ cin>>arr[i];
+ }
+ int mx=INT32_MIN;
+ mx=max(mx,arr[i]);
+ cout<<mx<<endl;
+}
18
+int main() {
19
+ solve();
20
+ return 0;
21
0 commit comments