꾸준한 노력🔥🔥
오늘은 웹프로그래밍 수업과 알고리즘 실습을 진행하였습니다!
여전히 빠른 진도를 따라가지 못하는 1인.....
네...저입니다.....😂
1) 웹프로그래밍
웹프 수업에서는 번개(?) 그룹 실습을 진행했어요!
교수님이 내주시는 간단한 퀴즈를 풀고,
랜덤으로 묶인 4인과 함께 교수님이 내주시는
html, css, bootstrap 을 이용한 문제를 해결 하는
과정을 진행 하였습니다아..
갑작스럽게 묶인 그룹원들과 어리둥절 했지만,
모두들 예습을 잘 해오셨고,
적극적으로 참여 해주셔서 시간 내에 재출 할 수 있었다고 생각해요!
아래 html, css 는 번개(?)로 묶인 그룹원들과 주어진 시간에
교수님이 내주신 문제를 해결하여 재출한 결과물 입니다!
html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-lg-8 col-sm-12 col-12 red size">
<div class="row">
<div class="col-lg-9 col-sm-12 col-12 skyblue smallsize"></div>
<div class="col-lg-3 col-sm-12 col-12 green smallsize"></div>
</div>
</div>
<!--1 / 1-a, 1-b -->
<div class="col-lg-3 col-sm-6 col-12 yellow size"></div>
<!-- 2 -->
<div class="col-lg-1 col-sm-6 col-12 black size"></div>
<!-- 3 -->
</div>
<div class="row">
<div class="col-lg-6 col-sm-8 col-12 blue size"></div>
<!-- 4 -->
<div class="col-lg-6 col-sm-4 col-12 MediumSeaGreen size"></div>
<!-- 5 -->
</div>
<div class="row">
<div class="col-lg-12 col-sm-6 col-12 brown size"></div>
<!-- 6 -->
<div class="col-lg-12 col-sm-6 col-12 gold size"></div>
<!-- 7 -->
</div>
</div>
</body>
</html>
CSS
[class*="col"] {
border: solid 10px;
}
.size {
height: 200px;
}
.smallsize {
height: 90px;
}
div.red {
color: red;
}
div.skyblue {
color: skyblue;
}
div.green {
color: green;
}
div.yellow {
color: yellow;
}
div.black {
color: black;
}
div.blue {
color: blue;
}
div.MediumSeaGreen {
color: mediumseagreen;
}
div.brown {
color: brown;
}
div.gold {
color: gold;
}
아직은 코딩 애기...? 이지만 더욱 더 노력하여 실력을 쌓는다면
후에 게시물을 봤을때 뿌듯하겠죠.....?
생각보다 구조는 바로 떠올렸지만, 제 자신의 실력이 부족함을
많이 느꼈습니다.
2) 알고리즘 과제 수행
첫 알고리즘 과제를 받았는데,
정렬 문제였습니다.
filestream 을 이용하여 조교님이 올려주신
데이터를 이용하여 삽입정렬, 버블 정렬을 작성
정렬한 파일을 생성하는 과정을
작성 하였습니다!
첫 과제라 난이도는 매우 쉬움!
또한 구선생님(구글) 도움을 받아
어렵지 않게 코딩,,,,? 했습니다...
(코딩이라 말하고 복붙이라 부른다. 그래도 클론코딩 했어요.....!...ㅎㅎ)
버블정렬
package Bubble_Sort;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.util.StringTokenizer;
public class Bubble_Sort {
static int count = 0;
public static void main(String[] args) {
String _Sort = "Bubble_sort";
String filePath = "./data01.txt";
String out_filePath = "hw01_00_201802170_" + _Sort + ".txt";
System.out.println(_Sort);
int[] array = read(filePath);
array = sort(array);
write(array, out_filePath);
System.out.println(count);
}
public static int[] read(String _path) {
String contents = "";
try (FileInputStream fstream = new FileInputStream(_path);) {
byte[] rb = new byte[fstream.available()];
while (fstream.read(rb) != -1) {
}
fstream.close();
contents = new String(rb);
} catch (Exception e) {
// TODO: handle exception
e.getStackTrace();
}
StringTokenizer st = new StringTokenizer(contents, ",");
int[] array = new int[st.countTokens()];
for (int i = 0; st.hasMoreElements(); i++)
array[i] = Integer.parseInt(st.nextToken());
print_array(array);
return array;
}
public static void write(int[] array, String out_filePath) {
print_array(array);
String str = "";
for (int i = 0; i < array.length - 1; i++)
str += Integer.toString(array[i]) + ",";
str += Integer.toString(array[array.length - 1]);
try (FileWriter fw = new FileWriter(out_filePath);) {
fw.write(str);
fw.close();
} catch (IOException e) {
// TODO: handle exception
e.printStackTrace();
}
}
public static void print_array(int[] array) {
for (int i = 0; i < array.length; i++) {
System.out.print(array[i] + " ");
}
System.out.println();
}
public static int[] sort(int[] array) {
for (int i = 1; i < array.length; i++) {
for (int j = 0; j < array.length - i; j++) {
if (array[j] > array[j + 1]) {
swap(array, j, j + 1);
}
count++;
}
}
return array;
}
private static void swap(int[] a, int i, int j) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
삽입정렬
package Insertion_Sort;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.util.StringTokenizer;
public class Insertion_Sort {
static int count = 0;
public static void main(String[] args) {
String _Sort = "Insertion_sort";
String filePath = "./data01.txt";
String out_filePath = "hw01_00_201802170_" + _Sort + ".txt";
System.out.println(_Sort);
int[] array = read(filePath);
array = sort(array);
write(array, out_filePath);
System.out.println(count);
}
public static int[] read(String _path) {
String contents = "";
try (FileInputStream fstream = new FileInputStream(_path);) {
byte[] rb = new byte[fstream.available()];
while (fstream.read(rb) != -1) {
}
fstream.close();
contents = new String(rb);
} catch (Exception e) {
// TODO: handle exception
e.getStackTrace();
}
StringTokenizer st = new StringTokenizer(contents, ",");
int[] array = new int[st.countTokens()];
for (int i = 0; st.hasMoreElements(); i++)
array[i] = Integer.parseInt(st.nextToken());
print_array(array);
return array;
}
public static void write(int[] array, String out_filePath) {
print_array(array);
String str = "";
for (int i = 0; i < array.length - 1; i++)
str += Integer.toString(array[i]) + ",";
str += Integer.toString(array[array.length - 1]);
try (FileWriter fw = new FileWriter(out_filePath);) {
fw.write(str);
fw.close();
} catch (IOException e) {
// TODO: handle exception
e.printStackTrace();
}
}
public static void print_array(int[] array) {
for (int i = 0; i < array.length; i++) {
System.out.print(array[i] + " ");
}
System.out.println();
}
public static int[] sort(int[] array) {
for(int i = 1; i < array.length; i++) {
int target = array[i];
int j = i - 1;
while(j >= 0 && target < array[j]) {
array[j + 1] = array[j];
j--;
count++;
}
array[j + 1] = target;
count++;
}
return array;
}
}
확실히 오늘은 단순 코딩 공부를 한것이 티가 나네요.,ㅎㅎ
부족한것은 채우고 배운것은 단단하게 두드리자!
더욱 정진하자 !
'학부생나부랭이 > _zoom' 카테고리의 다른 글
2021_09_27~29)zoom study (0) | 2021.09.29 |
---|---|
2021_09_16)zoom study (0) | 2021.09.16 |
2021_09_14)zoom study (0) | 2021.09.14 |
2021_09_13)zoom study (0) | 2021.09.13 |
댓글