This text file describes brief but precise and complete specification of project including:
- funtion descriptions: name, input/output parameters
- declaration of of important data and data types to be included in user header file
- your team's brief ideas of implementations
Your description start form next line and do not delete lines upto this point.
<ํ๋ก์ ํธ ์์ฝ>
- Input data ๋ฅผ ์์ฑํ๋ function gendata๋ก str, n, d data๋ฅผ ์์ฑ
- trivial solution, juggling / block-swap / reverse 4๊ฐ์ง ๋ฐฉ๋ฒ์ผ๋ก ๊ตฌ๋ถ
- String length์ rotate distance์ ๋ฐ๋ฅธ ์ํ์๊ฐ์ ์ฐจ์ด๋ฅผ ๋น๊ต ์ถ๋ ฅ
<์ญํ ๋ถ๋ด>
- main : ๊น๋ณ์ฃผ
- trivial solution : ์ด์ฐฌ์
- juggling : ์ ์นํ
- blockswap : ์ต์น์
- reverse : ๋ฐ์ํ
< fuction descriptions >
name : trivial input parameter : char *str, int n, int d output parameter : void
name : jug input parameter : int d, int num, char *vector, int gcd output parameter : void
name : BS input parameter : int Length, int D, char *str output parameter : void
name : swap input parameter : int a, int z, int sD, char *str output parameter : void
name : Rev input parameter : int Length, int D, char *str output parameter : void
name : reverse input parameter : int start, int end, char *str output parameter : void
< Declaration of important data and data types in user header file>
- ํ์ผ๋ช : header.h
- ์ฌ์ฉ๋ ํค๋ํ์ผ : <stdio.h>, <stdlib.h>, <string.h>, <math.h> <time.h>
- main์ ์ฌ์ฉํ ํจ์ ์ ์ธ : BS, Swap, Rev, reverse, trivial
< test's result >
String distance Rotate distance Trivial Reverse Juggling BS
100 3 0.000000ms 0.000000ms 0.000000ms 0.000000ms 1000 10 2.000000ms 0.000000ms 0.000000ms 0.000000ms 10000 1234 28.000000ms 0.000000ms 14.00000ms 0.000000ms 10000 3000 160.000000ms 0.000000ms 0.000000ms 0.000000ms 100000 30 38.000000ms 3.000000ms 5.000000ms 2.000000ms 1000000 10000 26554.0000ms 3.000000ms 4.000000ms 3.000000ms 1000000 30 77.000000ms 4.000000ms 8.000000ms 3.000000ms
< ์ถ๋ก ๊ฒฐ๊ณผ >
(string distance : n, rotate distance : d)
trivial ๋ฐฉ์์ ๊ฒฝ์ฐ ์คํํ ๋, ๋กํ ์ดํธํ๊ณ ์ถ์ ๋งํผ n X d๋ฒ ๊ณ์ฐํด์ฃผ์ด์ผํ๊ธฐ ๋๋ฌธ์ ๊ฐ์ฅ ์ค๋๊ฑธ๋ฆฐ๋ค. >> (n X d)
juggling ๋ฐฉ์์ n, d์ ๊ด๊ณ์ ๋ฐ๋ผ ์คํ์๊ฐ์ด ๋ฌ๋ผ์ง๋ค. n,d ๊ฐ ์๋ก์์ ๊ด๊ณ์ผ ๊ฒฝ์ฐ ์ค๋๊ฑธ๋ฆฌ์ง๋ง, ์ต๋๊ณต์ฝ์๊ฐ ์ปค์ง์๋ก ๋น ๋ฅธ ์๊ฐ์ ๋ํ๋ธ๋ค. >> ( ์ต์ n๋ฒ )
reverse ์ด 3๋ฒ ๊ณ์ฐ์ด ์ด๋ฃจ์ด์ง๋๋ฐ ์์์ d๋งํผ, ๋๋จธ์ง๋ถ๋ถ n-d, ์ ์ฒด๋ถ๋ถ n์์ ๊ฐ๊ฐ d/2๋ฒ, (n-d)/2๋ฒ, n/2๋ฒ์ ๊ณ์ฐ์ด ์ด๋ฃจ์ด์ ธ ์ด n๋ฒ์ ๊ณ์ฐ์ด ์ด๋ฃจ์ด์ง๋ค. >> ( n๋ฒ )
block - swap ์ข์ฐ ๊ธธ์ด๋ฅผ ๋น๊ตํ์ฌ ์งง์ ๊ธธ์ด๋งํผ์ ๊ณ์ฐ๊ณผ์ ์ ์ข์ฐ ๊ธธ์ด๊ฐ ๊ฐ์๋๊น์ง ๋ฐ๋ณตํด์ค๋ค. ๋ฐ๋ผ์ ์ต์ ์ ๊ฒฝ์ฐ n๋ฒ์ ๊ณ์ฐ์ด ๊ฑธ๋ฆฌ๊ฒ ๋๋ค. d๊ฐ n์ ์ฝ์์ผ ๊ฒฝ์ฐ, ์ฝ์์ค์์ ํฐ ์ ์ผ์๋ก ๋ ๋น ๋ฅธ ๊ณ์ฐ์ด ์ด๋ฃจ์ด์ง๋ค.>> ( ์ต๋ n๋ฒ )
๋ฐ๋ผ์, block - swap > reverse > juggling > trivial ( ๋น ๋ฅด๊ธฐ ์์)