2010-02-20 180 views
8

我將在今年夏天教授我的第一部大學水平的計算機科學課程,目前我正在努力提出學生將完成的有趣任務的想法。該課程是該課程的第二部分,涵蓋了算法和基本數據結構的分析,如堆棧,隊列,列表,樹等。計算機科學入門課

我有很多想法可以運行(創建帶有馬爾可夫鏈的音樂,Twitter客戶端等),但我總是在尋找對學生來說很有趣/有趣的新想法 - 畢竟,當一個人玩得開心時,最容易成爲/仍然從事課程材料。我正在尋找關於您或其他人可能在過去完成的第一年級別任務的意見。

之前有人提出這個問題,是的,我知道關於漂亮的作業,並已檢查出來。只是請求你可能有的任何其他想法。我們都記得大學的一些特別有趣的作業。這些是我理想中要求的體驗。

+0

看看我在同一領域的問題,也許你會發現有用的東西在那裏http://stackoverflow.com/questions/1318770/impressive-examples-in-java – Roman 2010-02-23 14:09:58

回答

2

SICP有一些非常不錯的作業。

4

「有趣」作業的麻煩在於,他們通常對學生來說比學生希望的更多的工作。特別是英語不好的學生和學生在最後一刻離開作業。 [然後用「請做我的作業」的問題開啓SO。]他們中的很多人在設置任務時都會遇到困難,但是你不需要一大堆抱怨練習的學生感到惡化太難了,或者沒有被你的講義報道。

我的建議(從經驗)是儘量保持背景知識的數量和對標記的編程任務的「挑戰」低。

爲可選的練習設置有趣的問題是一個合理的想法,但重要的是要警告學生不要花時間在他們身上,而犧牲其他更重要的工作。

+0

我絕對同意,並期待保持作業簡短且相對簡單 - 但也希望甜蜜。 :)我有機會在過去爲同一課程創建一些作業(在教學助理角色中)。一些運作良好,而且有些結果正如你所描述的那樣 - 有趣而有趣,但對於學生來說太長和複雜。儘管如此,我希望找到一些可能足夠簡單的理解和完成的寶石,同時仍然很有趣。當然,我尊重你的答案,並會大步前進以保持簡單。 – 2010-02-20 07:33:08

+1

英語不好的學生和將作業留到最後幾分鐘的學生在達到大學水平之前應該已被過濾很久。在「樂趣」級別上仍然合理,在檢查作業和與學生互動時會減少麻煩。 – Anonymous 2010-02-20 15:13:37

+1

@匿名 - 不幸的是,這不是它真正的作用方式。 – 2010-02-21 01:52:55

1

我一直在使用下列網頁中的一個靈感:

你。也可以使用競賽中的任務(example),但這很可能需要您的一些工作 - 以確保分配作業的公平性(有些可能會比較棘手,而不是集中於你提到過的)。

0

有一件事可以考慮,也許不適合學生所做的第一門編程課程,但是稍後會將他們的代碼從他們以前的作業(他們自己或他人的)手中修復。如果您選擇不正確的提交,理想情況下有微妙的缺陷,這會更好。

一個類似的想法是有一個實驗序列,使用前面實驗的(成功完成的)代碼作爲起點。當我在很久以前的LiU上做了介紹性編程課程(PINK--增量系統編程)時,有一部分實驗室工作(實質上)歸結爲實現日曆,使用抽象類型和訪問器,然後事後改變抽象類型的實現。對於說明提供良好界面的需求非常有價值,如果沒有其他內容(從內存來看,我最終花了一兩天的時間思考「更改實施」),然後實際改變了15-20分鐘我的抽象數據類型,因爲我在前面做了艱苦的工作,只是需要說服自己)。

0

豬拉丁文。

讓您的學生編寫將英文文本流轉換爲Pig Latin的代碼。 The rules非常簡單,但它們需要一些有趣的特殊情況,特別是在標點和大寫時,要求它們編寫基本的掃描儀/標記器。

在一個典型的一句話是這樣的:

Quietly, Anne walked into the forest. 

你應該得到這樣的:

ietly-quay, Anne-ay alked-way into-ay e-thay orest-fay. 

,但你很可能得到:

uietly,-Qay Anne-ay alked-way into-ay e-thay orest.-fay 

已放錯地方的標點符號,不當放置曲和不正確的大寫。

0

一對夫婦的我發現與學生產生共鳴的想法:

  1. 分形藝術 - 一個很好的方式來教遞歸,因爲學生可以可視化的過程(如謝爾賓斯基三角形,L-systems雄心勃勃的學生)。您可以在context free art上看到使用上下文無關語法生成的一些非常令人印象深刻的圖形。
  2. 圖像處理 - 通過在圖像上映射像素操作函數來教授函數式編程(例如交換顏色通道,高斯模糊,處理色調);這比典型的syntax tree-based generative art作業要簡單一些。

關於教授入門級計算機科學課程最難的部分是整個典型班級的編程能力差距。因此,如果您可以爲能力較差的學生創建足夠簡單的作業,並且可以輕鬆地將其擴展(例如通過額外學分),以便爲高級學生解決更復雜的問題,那麼在我看來這是理想的選擇。

1

package assignment01;/*確保這個類在包assignment01中。 */

import java.util.ArrayList; import java.util.Arrays;

/** *該類是執行各種數學函數的方法的集合。這些方法都是靜態的。這個 *類是作業#1的一部分。 * * @author .......... * @version 2010年6月15日 */ 公共類MathLibrary {

/** 
* Computes and returns the mean (average) of the numbers in the list. 
* 
* If the input list is empty, the returned mean is 0.0. If the list contains illegal values, the behavior of this 
* method is undefined. 
* 
* @param list 
*   an ArrayList of double values 
* @return the mean of the values in the list 
*/ 
public static double mean (ArrayList<Double> list) 
{ 
    // Variables 

    Double sum = 0.0; 
    int arraySize = 0; 

    // Check for empty list 

    if (list.size()== 0) 
     return 0.0; 

    // Take sum 

    arraySize = list.size(); 
    for(int i = 0; i < arraySize; i++) 
    { 

     // Check for null Double 

     if(list.get(i) == null) 
     { 
      System.out.println("Mean Function: Array has null element at index: " + i + "."); 
      return -1.0; 
     } 

     // Add element 

     sum += list.get(i); 
    } 

    // Return average of results 

    return (sum/arraySize); 
    } 

/** 
* Computes and returns the median value of the numbers in the list. If the list has an odd number of elements, the 
* exact median value is returned. If the list has an even number of elements, the average of the middle two 
* elements is returned. 
* 
* If the input list is empty, the returned mean is 0.0. If the list contains illegal values, the behavior of this 
* method is undefined. 
* 
* The order of the elements in the input array may be changed by this method. 
* 
* @param arr 
*   an array of double values 
* @return the median of the values in the list 
*/ 
public static double median (double[] arr) 
{ 
    // Variables 

    double arraySize = 0; 
    double arrayMedian = 0.0; 
    double temp = 0.0; 
    boolean unsorted = true; 

    // Check for empty array 

    arraySize = arr.length; 
    if (arraySize == 0.0) 
     return 0.0; 

    // Sort array 

    while(unsorted) 
    { 
     unsorted = false; 
     for(int i=0; i < arraySize - 1; i++) 
     { 
      if(arr[i] > arr[i+1]) 
      { 
       unsorted = true; 
       temp = arr[i + 1]; 
       arr[i+1] = arr[i]; 
       arr[i] = temp; 
      } 
     } 
    } 

    // Find median 

    if((arraySize % 2) == 0) 
    { 
     // Take average of two middle array indicies 

     arrayMedian = (arr[(int) (arraySize/2.0 - 0.5)] + arr[(int) (arraySize/2.0 + 0.5)])/2.0; 
    } else { 
     arrayMedian = arr[(int) (arraySize/2.0)]; 
    } 


    return arrayMedian; 
    } 

/** 
* Computes and returns the largest integer that divides (without remainder) both of the input integers (the 
* greatest common divisor). 
* 
* If either of the input integers is not positive, this method returns -1. 
* 
* @param a 
*   any positive integer 
* @param b 
*   any positive integer 
* @return the greatest common divisor of a and b 
*/ 
public static int gcd (int a, int b) 
{ 
    int gcd = 1; 
    int minimum; 

    // Check for (a || b) < 0 

    if ((a < 0) || (b < 0)) 
     return -1; 
    if ((a == 0) || (b == 0)) 
     return 0; 

    // Compute half the minimum(a,b) 

    minimum = Math.min(a,b); 

    // For each number below half the minimum of the two check for divisibility 

    for(int i = 1; i <= minimum; i++) // zero case is already accounted for 
    { 
     // Check for divisibility 

     if(((a % i) == 0) && ((b % i) == 0)) 
     { 
     gcd = i; 
     } 
    } 

    return gcd; 
} 

/** 
* Computes and returns the smallest integer that can be divided by (without remainder) both of the input integers 
* (the least common multiple). 
* 
* 
* If either of the input integers is not positive, this method returns -1. If the least common multiple exceeds the 
* maximum possible integer value, the behavior of this method is undefined. 
* 
* @param a 
*   any positive integer 
* @param b 
*   any positive integer 
* @return the least common multiple of a and b 
*/ 
public static int lcm (int a, int b) 
{ 
    // Variables 

    int lcm = 0; 

    // Check for negative numbers 

    if((a < 0) || (b < 0)) 
     return -1; 

    // Use gcd to get lcm 

    lcm = (a * b)/gcd(a,b); 

    return lcm; 
    } 

/** 
* Given a number n, this method computes and returns the smallest prime number larger than n. 
* 
* If the input integer is not positive, this method returns 2. If the next prime number exceeds the maximum 
* possible integer value, the behavior of this method is undefined. 
* 
* @param n 
*   an integer 
* @return the smallest prime number larger than n 
*/ 
private static boolean isPrime(int n) 

{ 

if(n == 2 || n == 3) 
{ 
    return true; 
} 

if(n == 1 || n % 2 == 0) 
{ 
    return false; 
} 
for(int i = 3; i * i <= n; i += 2) 

if(n % i == 0) 
{ 
    return false; 
} 


return true; 

} 

public static int nextPrime(int n) 
{ 
    if (n<0) 
{ 
    return 2; //if n is not positive. 
} 
    int value = n; 
    if (n == 2) 
    value = 3; //finds the next prime number. 
    else 
    { 
    do 
    { 
     value += 1; 
    } while (!isPrime(value)); 
    } 
    return value; //displays the next prime number. 
} 

}

0

一個任務我思念的時候我回想起我在大學初期的任務,旨在教導我們關於GUI的任務。我們被要求實施一個網頁瀏覽器。

Web內容的實際顯示並不特別重要 - 我們被鼓勵使用Swing的Web視圖 - 這是更多關於這支持了這一功能:

  • URL欄
  • 歷史
  • 前進和後退
  • 設置主頁
  • 保持書籤/收藏夾
  • 標籤browsi NG

分配給了你自由發揮來選擇它們的任意組合,只要你做了至少一組號碼。這讓真正熱衷的人能夠實現絕對所有的功能,並且允許任何更加匆忙的人實現最低限度的功能。

多年來,還有一些類似的方式構建了更多的任務,並且它們總是順利完成。你會感到驚訝的是,學生們會多花多少時間去做更多的事情,並且做得比所需要的多。


根據經驗,一般情況下,這個事情我和我的coursemates似乎找到了最吸引人的是更直觀:在OpenGL,圖形用戶界面,網站等任何基於命令行程序並沒有想象中的樂趣。

也許正如你專注於算法,讓學生可視化排序/搜索算法可能是一個好主意。除了教他們關於圖形框架外,它還有助於可視化算法並加深對它的理解。你可以用數據結構的自定義實現做類似的事情。

這個關鍵在於找到一個圖形框架,這個框架合理直觀,記錄完善,使用方便,支持得當。沒有比讓我們使用現實世界中沒有人真正使用的技術的任務更令人沮喪的了。你不想讓這門技術成爲這項任務中最難的部分。

我不認爲你會教他們使用一個可能被認爲超出該模塊範圍的框架是一件壞事:學習如何使用新的框架和庫本身就是一項技能,如果你想成爲一名有效的軟件開發人員,並且大學似乎沒有明確地教授這一點,就需要開發它。