Re: [請益] 106鐵路人員考試資訊處理之資料結構

看板Examination作者 ( )時間8年前 (2017/06/20 14:07), 編輯推噓1(102)
留言3則, 2人參與, 最新討論串2/2 (看更多)
※ 引述《Gelo (米基)》之銘言: : 請問昨天的鐵路人員特考高員三級,資料處理類科的資料結構第一題,考友可以分享作法嗎? : 題目如下: : (一)串列是一個函數,從整數的子集合對應到另一個集合,請寫出兩個集合s1,s2及一個 : 函數f來定義串列[2,2,1,3] 我知道了! define: f(s1[i]) = s2[i], i in [0,|s2|) let: s1 = [0,1,3,4] s2 = [2,2,1,3] int f(int i) throws ArrayIndexOutOfBoundException { int[] s2 = {2, 2, 1, 3}; int N = s2.length; if(N>0 && i>=0 && i<N) return s2[i]; else throw new ArrayIndexOutOfBoundException(); } 大概4這樣吧! : (二)分別使用Java ArrayList及Java LinkedList來實作上述的串列,請分別畫出草圖 : (sketch)表示之(注意:兩種資料結構的草圖上,都要註明索引index) -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.112.25.121 ※ 文章網址: https://www.ptt.cc/bbs/Examination/M.1497938820.A.C1A.html

06/20 18:35, , 1F
06/20 18:35, 1F

06/20 19:02, , 2F
個人覺得 題目問的沒這麼複雜
06/20 19:02, 2F

06/20 19:04, , 3F
樓主 s1 從何而來? 感覺也許樓主誤會題意
06/20 19:04, 3F
文章代碼(AID): #1PIBk4mQ (Examination)
文章代碼(AID): #1PIBk4mQ (Examination)