精華區beta b885060xx 關於我們 聯絡資訊
來源:http://www.csie.ntu.edu.tw/~ds/hw/hw1.html Discussion Time : 2000/09/26 (Tue.) Course Lecture (2:10pm-4:00pm) Submission Due Day: 2000/10/03 (Tue.) 2:00pm Demostration: 2000/10/03 (Tue.) -- 2000/10/05 (Thu.) Preliminary: Pascal's Triangle is an infinite triangular array of integers that starts out as shown below: 圖就自己想像吧,要不就去網頁上看。 The number in row n and column m of the triangle is denoted by P(n, m). If the number is on the left edge or right edge of the triangle, it is 1. That is: P(n, m)= 1, if m=1 or m=n Otherwise, it is the sum of the two numbers closest to it in the preceding row. That is: P(n, m)= P(n-1, m-1) + P(n-1, m) Objective: Learn to use array as the data structure programs. Learn to analyse the time/space complexity of programs. Program Assignment: Write a program that takes (n, m) as inputs and outputs p(n, m). Use an array (or arrays) to implement the program. Oral Tests: Describe how you design the program. Explain what time/space complexity is. Analyse the time/space complexity of your program. -- ※ 發信站: 批踢踢實業坊(ptt.twbbs.org) ◆ From: h218.s23.ts31.hinet.net