Browse Source

initial commit

Froilan Miranda 6 years ago
commit
b4233e0495
2 changed files with 27 additions and 0 deletions
  1. 0
    0
      README.md
  2. 27
    0
      Week 1.md

+ 0
- 0
README.md View File


+ 27
- 0
Week 1.md View File

@@ -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 }`