Home Contact Me
NTUT logo
Design and Analysis of Computer Algorithms (瞍蝞瘜閮剛), Fall 2010


Announcement
Lecturing Information
Slides
Projects
Grading
Projects (雿璆)
Project 6
  • Use C language to implement the Huffman coding with greedy.
    1. The input file name should be retrieved through argv[1] of main() function.
    2. Use fscanf() to get integers from the input file.
      • The first integer indicates the number of characters. After the first integer, there are i floating values. The i-th input floating value indicates the possibility of the ith character.
      • E.g., 3 0.3 0.4 0.3 means there are 3 characters with respective probabilities 0.3, 0.4, and 0.3.
        Output:
        0.3: 10
        0.4: 0
        0.3: 11
    3. Find and output the codeword for each character.
  • Deadline: 24:00, 2010.11.22
    1. Email the .c or .cpp program to me: johnsonchang[at]ntut.edu.tw
    2. Email title: Algo_P6_摮貉_憪
  • Sample input file: download here


Project 5
  • Use C language to implement the Matrix-chain multiplication problem with dynamic programming.
    1. The input file name should be retrieved through argv[1] of main() function.
    2. Use fscanf() to get integers from the input file.
      • The first integer indicates the number of matrices.
      • E.g., 6 30 35 15 5 10 20 25 means there are 6 matrices (A1 to A6) and p0 to p6 are 30, 35, 15, 5, 10, 20, 25, respectively.
    3. Find and output the minimal number of multiplications and the parenthesization of the matrices.
      E.g., 15125, ((A1(A2A3))((A4A5)A6))
  • Deadline: 24:00, 2010.10.25
    1. Email the .c or .cpp program to me: johnsonchang[at]ntut.edu.tw
    2. Email title: Algo_P5_摮貉_憪
  • Sample input file: download here


Project 4
  • Use C language to implement the maximum-subarray problem with divide-and-conquer.
    1. The input file name should be retrieved through argv[1] of main() function.
    2. Use fscanf() to get integers from the input file.
      • The first integer indicates the length of the rod to cut.
      • The first integer also indicates the number of input integers in this file.
      • The i-th input integer indicates the revenue of the rod of length i.
      • E.g., 4 1 5 8 9 means there is a 4-inch rod. 1, 5, 8, and 9 are the revenue of the rod of 1, 2, 3, and 4 inches, respectively.
    3. Find and output cuts and the maximal revenue on the screen.
      .E.g., 2, 2: 10
  • Deadline: 24:00, 2010.10.18
    1. Email the .c or .cpp program to me: johnsonchang[at]ntut.edu.tw
    2. Email title: Algo_P4_摮貉_憪
  • Sample input file: download here


Project 3
  • Use C language to implement the maximum-subarray problem with divide-and-conquer.
    1. The input file name should be retrieved through argv[1] of main() function.
    2. Use fscanf() to get integers from the input file.
      • The first integer indicate the number of input integers in this file.
      • E.g., 4 1 4 3 -4 means there are four changes that are 1, 4, 3 and -4.
    3. Find and output the maximal interval and the maximal revenue.
      E.g., 1..3, 8
    4. Sort the input integers and output the sorted integers in the monotonically increasing order on the screen.
  • Deadline: 24:00, 2010.10.04
    1. Email the .c or .cpp program to me: johnsonchang[at]ntut.edu.tw
    2. Email title: Algo_P3_摮貉_憪
  • Sample input file: download here


Project 2
  • Use C language to implement the merge sort with divide-and-conquer.
    1. Use fscanf() to get integers from the input file.
      • The first integer indicate the number of input integers in this file.
      • E.g., 3 34 45 67 means there are three integers that are 34, 45, and 67.
    2. Use malloc() to allocate memory space for the input integers.
    3. Sort the input integers and output the sorted integers in the monotonically increasing order on the screen.
  • Deadline: 24:00, 2010.09.27
    1. Email the .c or .cpp program to me: johnsonchang[at]ntut.edu.tw
    2. Email title: Algo_P2_摮貉_憪
  • Sample input file: download here


Project 1
  • Use C language to implement the insertion sort (suggested tool: Dev C++).
    1. Use fscanf() to get integers from the input file.
    2. Sort the input integers and output the sorted integers in the monotonically increasing order on the screen.
  • Deadline: 24:00, 2010.09.20
    1. Email the .c or .cpp program to me: johnsonchang[at]ntut.edu.tw
    2. Email title: Algo_P1_摮貉_憪
  • Sample input file: download here


     


Page TopPage Top

 

Yuan-Hao Chang
Copyright © All Rights Reserved.