??(recursion) - PowerPoint PPT Presentation

About This Presentation
Title:

??(recursion)

Description:

(backtrack) (divide-and-conquer) ... (http://www.linux.or.jp/JM/) ... – PowerPoint PPT presentation

Number of Views:46
Avg rating:3.0/5.0
Slides: 22
Provided by: Takeh4
Category:

less

Transcript and Presenter's Notes

Title: ??(recursion)


1
?????
  • 2006?12?8?(?)

2
??????
  • ?????
  • ?????????????????????
  • ??(recursion)
  • ???????

3
?????
  • ??????????(?7?)?????
  • ?????????????
  • ????(?????????,?????)????.
  • ???,???????????????,???????????????,?????.
  • ???????
  • ????,??????,???? ??????.
  • ????????????.
  • ?????????????????.

?????
4
????????
  • ??????????????????,??????(????????,recursive
    call)???.
  • ??
  • ???(???,???)???
  • ???????(backtrack)
  • ?????(divide-and-conquer)
  • ???
  • ???????????????.
  • ?????????????????.

5
??????????????
  • ????countdown??????,countdown????????.

6
??????????????
  • ??????????,??????????.
  • ???????,??????????,??????????????????,?????.
  • ??????????????????????????(???????)?????.
  • ??????????????,?????????????????(?????????)???????
    ?

7
???????????????
main?????? ???????????
num 2
8
????????(1)
  • ??
  • 0! 1, 1! 1
  • n! n(n-1)! (n?2)
  • ????????
  • a1 1, a2 1
  • an an-1 an-2 (n?3)
  • ???????????,????????.
  • ???????,while????????????.

9
????????(2)
  • ???
  • ?????????????????,???????????
  • 100???????,?????????????
  • ??????????????????????????
  • ??????????
  • ??????????,????????????
  • ???????????????????

10
?????
  • ????????(??)????(??),?????????????????.
  • ? ???????

4
2
5
1
6
8
3
7
1
7
8
6
5
4
3
2
11
??????????????
  • ????,????,??????????.

4
2
5
1
6
8
3
7
2
8
5
7
6
1
3
4
1
7
8
6
5
4
3
2
12
?????????(quicksort.c)
main
swap
get_array_length
quicksort
print_score
??!
13
???
  • ??????????????????,??????????????????.
  • ?????????????????,???.
  • ???,????????????????.
  • ????auto???,??????????????.

14
?????
  • 2006?12?8?(?)?2

15
???????
  • ??????????
  • ??????????.
  • ????????????,????????????????????????.
  • (??)?????
  • ???? ???????.? 12?1?????
  • ??????? ???????.printf??.? ???????

16
???????????????
  • ?????????????????????,?????,????????(???????)?????
    ??.
  • printf ?? include ltstdio.hgt
  • CHAR_BIT ?? include ltlimits.hgt
  • ????????,??????????????,manpage ?????????.
  • man 3 printf
  • jman 3 printf
  • JM Project (http//www.linux.or.jp/JM/)
  • ???????????????????????,?????,?????.

Vine Linux?????
17
??????????????
  • ?????????,??,????????,????????????????????.
  • include ltstdlib.hgt ????,/usr/include/stdlib.h
    ?????(????????).
  • ?????,???????.h???????.
  • ??????????,???????????????????????????.
  • ?????????????????.??????????????????,include
    "headerfile.h" ??????.

18
??????????(1)
  • include ltstdio.hgt ????????
  • int printf(const char format, ...)
  • int scanf(const char format, ...)
  • int putchar(int c) 1????
  • int getchar(void) 1????
  • int sprintf(char str, const char format, ...)
    printf???????????,???str(?????????)?????

???? ?????
???? ?????
19
??????????(2)
  • include ltstdlib.hgt ????????
  • int atoi(char s) ????????????
  • void exit(int status) ????????
  • int rand(void) ????
  • include ltstring.hgt ????????
  • size_t strlen(char s) ??????
  • int strcmp(char s1, char s2) ?????
  • char strstr(char s1, char s2) ?????
  • char strcat(char dest, char src) ?????

20
??????????(3)
  • include ltctype.hgt ????????
  • int isdigit(int c) ???????????
  • isalpha?????,isalnum??????
  • int tolower(int c) ??????????
  • ?????????????
  • ??toupper
  • include ltmath.hgt ????????
  • double exp(double x) e?x?
  • double floor(double x) x????????
  • ???ceil,????(??)?round
  • ??????,?cc -lm program.c?????????????(linker
    option)???

21
??????
  • printf??,??printf
  • ???????????.
  • printf()??,??printf()
  • ?????????????????.??????.
  • printf(3)
  • ?printf??????????????,???,man 3
    printf??????????????.
  • ?(1)???????,?(2)?????????
  • man printf??????,???????????,????????printf???????
    ??.
  • ?printf?????3????????.
Write a Comment
User Comments (0)
About PowerShow.com