์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- From Machine Reading Comprehension to Dialogue State Tracking: Bridging the Gap
- How Much Knowledge Can You Pack Into the Parameters of a Language Model?
- MySQL
- few shot dst
- ์ ๋ณด์ฒ๋ฆฌ๊ธฐ์ฌ ์ฑ ์ถ์ฒ
- DST zeroshot learning
- Leveraging Slot Descriptions for Zero-Shot Cross-Domain Dialogue State Tracking
- ์ ๋ณด์ฒ๋ฆฌ๊ธฐ์ฌ ์์ ๋น
- ์ ๋ณด์ฒ๋ฆฌ๊ธฐ์ฌ์ ๊ณต์
- ๋ฐ์ดํฐ ํฉ์ฑ
- ๋ค์ด๋๋ฏน ํ๋ก๊ทธ๋๋ฐ
- ํ์ด์ฌ์ ํ์ด์ฌ๋ต๊ฒ
- Python
- ํ๋ก๊ทธ๋๋จธ์ค
- ๋ฅ๋ฌ๋๊ธฐ์ด
- fasttext text classification ํ๊ธ
- til
- Few Shot Dialogue State Tracking using Meta-learning
- Zero-shot transfer learning with synthesized data for multi-domain dialogue state tracking
- dialogue state tracking
- ๊ฒ์์์ง
- SUMBT:Slot-Utterance Matching for Universal and Scalable Belief Tracking
- ๋ชจ๋์๋ฅ๋ฌ๋
- ๋ฐฑ์ค
- ์์ฐ์ด์ฒ๋ฆฌ ๋ ผ๋ฌธ ๋ฆฌ๋ทฐ
- nlp๋ ผ๋ฌธ๋ฆฌ๋ทฐ
- ์ ๋ณด์ฒ๋ฆฌ๊ธฐ์ฌ์ ๊ณต์ํฉ๊ฒฉํ๊ธฐ
- 2020์ ๋ณด์ฒ๋ฆฌ๊ธฐ์ฌํ๊ธฐ
- DST fewshot learning
- classification text
Archives
- Today
- Total
๐ฒ์๋ผ๋๋์ฒญ๋
array list์ Dfs, bfs(java) ๋ณธ๋ฌธ
๋ฐ์ํ
package ch6;
//array ๋ก graph ๊ตฌํ
/*
* ์์ ์
๋ ฅ
* 4 5 1 ์ ์ ์์, ๊ฐ์ ์์, ํ์์ ์์ํ ๋ฒ
1 2
1 3
1 4
2 4
3 4
*/
import java.util.*;
public class graph_array {
static int[] check;
static int[][] a;
static int n=0;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
n = scan.nextInt();// node์ ์
check = new int[n+1];
a = new int[n+1][n+1];
int num = scan.nextInt();//๊ฐ์ ์ ์
int start = scan.nextInt();//ํ์์ ์์ํ ๋ฒํธ
for(int i=0; i<num; i++) {
int v = scan.nextInt();
int w = scan.nextInt();
a[v][w] = a[w][v] = 1;
}
//์ธ์ ์ด๋ ์ด ํ์ธ
// for(int i=1; i<n+1; i++) {
// for(int j=1; j<n+1; j++) {
// System.out.print(a[i][j] + " ");
// }
// System.out.println("");
// }
//dfs_r(start);
dfs_s(start);
for(int i=0; i<n+1;i++) {
check[i]=0;
}
System.out.println("");
bfs(start);
}
//recurrsive๋ก ๊ตฌํํ dfs
public static void dfs_r(int node) {
if(check[node]==0) {
System.out.print(node + " ");
check[node]=1;
}
for(int i=1;i<n+1;i++) {
if(check[i]==0&&a[node][i]==1) dfs_r(i);
}
return;
}
//stack์ผ๋ก ๊ตฌํํ dfs
public static void dfs_s(int v) {
Stack<Integer> stack = new Stack<>();
System.out.print(v+" ");
check[v]=1;
stack.add(v);
while (!stack.isEmpty()) {
boolean flag = false;
int vv = stack.peek();
for(int i=1;i<n+1;i++) {
if(a[vv][i]==1&&check[i]==0) {
flag = true;
System.out.print(i+" ");
stack.add(i);
check[i]=1;
break;
}
}
if(flag==false)
stack.pop();
}
}
//bfs
public static void bfs(int v) {
Queue<Integer> q = new LinkedList<>();
q.add(v);
System.out.print(v+" ");
check[v]=1;
while(!q.isEmpty()) {
v=q.poll();
for(int i=1;i<n+1;i++) {
if(a[v][i]==1&&check[i]==0) {
q.add(i);
check[i]=1;
System.out.print(i+" ");
}
}
}
return;
}
}
๋ฐ์ํ
'์๊ณ ๋ฆฌ์ฆ ๋ฌธ์ ํ์ด' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Q4963 ์ฌ์ ๊ฐ์ JAVA (0) | 2019.05.07 |
---|---|
Q 2667 ๋จ์ง๋ฒํธ ๋ถ์ด๊ธฐ JAVA (0) | 2019.05.07 |
array list๋ก ๊ตฌํํ graph (0) | 2019.04.02 |
์ธ์ array๋ก ๊ทธ๋ํ ๊ตฌํ(์๋ฐ) (0) | 2019.04.02 |
Q4344 ํ๊ท ์ ๋๊ฒ ์ง (0) | 2019.03.26 |