瀏覽代碼

initial commit

Froilan Miranda 6 年之前
當前提交
b4233e0495
共有 2 個文件被更改,包括 27 次插入0 次删除
  1. 0
    0
      README.md
  2. 27
    0
      Week 1.md

+ 0
- 0
README.md 查看文件


+ 27
- 0
Week 1.md 查看文件

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