|
@@ -0,0 +1,27 @@
|
|
1
|
+## Week 1
|
|
2
|
+### Problem 1
|
|
3
|
+Problem: Given an array arr[] of n elements, write a function to search a given element x in arr[].
|
|
4
|
+
|
|
5
|
+```
|
|
6
|
+Input : arr[] = {10, 20, 80, 30, 60, 50,
|
|
7
|
+ 110, 100, 130, 170}
|
|
8
|
+ x = 110;
|
|
9
|
+Output : 6
|
|
10
|
+Element x is present at index 6
|
|
11
|
+
|
|
12
|
+Input : arr[] = {10, 20, 80, 30, 60, 50,
|
|
13
|
+ 110, 100, 130, 170}
|
|
14
|
+ x = 175;
|
|
15
|
+Output : -1
|
|
16
|
+Element x is not present in arr[].
|
|
17
|
+```
|
|
18
|
+Hint: linear search
|
|
19
|
+
|
|
20
|
+### Problem 2
|
|
21
|
+Problem: Write a Java program to arrange the elements of an given array of integers where all negative integers appear before all the positive integers.
|
|
22
|
+
|
|
23
|
+Input:
|
|
24
|
+`{ 2, 5, -55, 8, -72, -1, 53 }`
|
|
25
|
+
|
|
26
|
+Output:
|
|
27
|
+`{ -55, -72, -1, 2, 5, 8, 53 }`
|