Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
349 views
CSC508
csc508
Uploaded by
aisyah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save CSC508 For Later
Download
Save
Save CSC508 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
349 views
CSC508
csc508
Uploaded by
aisyah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save CSC508 For Later
Carousel Previous
Carousel Next
Save
Save CSC508 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 6
Search
Fullscreen
CONFIDENTIAL = CSIDEC 2018/CSC508/518 & UNIVERSITI TEKNOLOGI MARA FINAL EXAMINATION COURSE : DATA STRUCTURES/DATA STRUCTURE AND ALGORITHM ANALYSIS COURSE CODE : CSC508/518 EXAMINATION : DECEMBER 2018 TIME : 3HOURS INSTRUCTIONS TO CANDIDATES 1 This question paper consists of five (5) questions. 2 Answer ALL questions in the Answer Booklet. Start each answer on a new page. 3 Do not bring any material into the examination room unless permission is given by the invigilator. 4, Please check to make sure that this examination pack consists of i) the Question Paper jl) an Answer Booklet ~ provided by the Faculty 5, Answer ALL questions in English. DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO This examination paper consists of 6 printed pages © Hak Cipta Universiti Toknologi MARA CONFIDENTIAL,CONFIDENTIAL 2 CSIDEC 2018/¢SC508/518 QUESTION 4 a) List THREE (3) basic operations performed on stack. (3 marks) b) Write an application to enqueue FIVE (5) random integer values in sequences into a queue named Number. (4 marks) ¢) Figure 1 below shows a piece of coding. Write the contents for both queue and stack at both comment lines. (5 marks) public class Ql ( public static void main(String s [] ) { Stack lew Stack(); Queue y=new Queue (); for(int i= { 3; i<80; i+=13) x.push (i); } for(int j=0; 3<3; j++) { y-enqueue(x-pop()) 7 } //#e+++%%¢4comment Line 1 while (!y.istmpty ()) ( x.push(y.dequeue() ) ; ) for(int j=0; j<3; j++) { y-enqueue(x.pop() ) + y //****4*4«%Comment Line 2 } y Figure 7 (© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL,CONFIDENTIAL 3 CSIDEC 2018/CSC508/518 d) Figure 2 shows the ADT of Bus and Queue classes. public class Bus { string regNo; // bus registration number String yearReg; // year registered with JPJ String owner; //name of the owner String stateReg; //which state the vehicle is registered eg. Pahang, Melaka, etc public Bus (String, String, String, String); public String getRegNo(); public String getYearReg(); public String getOwner(); public String getstate(); } public class Queue { public Queue(); public void enqueue (Object); public Object dequeue (); public Boolean isEmpty (); //definition for other methods. Figure 2 Queue named busQueue inserted with 50 busses information, write a Java program segments for the following requirements: i) Find the total number of busses which was registered in the year 2018 and display it. (Noted: In order to avoid data loss, use temporary queue to store bus information.) (4 marks) ii) From the temporary queue, move all buses that were registered in Melaka into a stack name M1kSt.ack and other busses into the original queue. (4 marks) QUESTION 2 a) Given the following list: 6, 10, 22, 29, 35, 41, 53, 76, 80, 100, 25 i) Show the values of first, last, mid and the number of comparison for search item 100. (4 marks) (© Hak Cipta Universiti Teknologi MARA CONFIDENTIALCONFIDENTIAL 4 CSIDEC 2018/CSC508/518 ll) Show the values of first, last, mid and the number of comparison for search item 27. (4 marks) b)_ State the TWO (2) differences between sequential search and binary search. (4. marks) ©) Uist eny THREE (3) commonly used Hash Method. (3 marks) d) Given the following values to be inserted into a hash table of size 5, draw a diagram of the hash table if the function uses the modular (%) method and hashing with chaining. 43, 32, 56, 192, 1000, 26, 34 78, 16, 66 (6 marks) QUESTION 3 a) Define Heap Sort, (3 marks) b) Briefly explain the way merge sort algorithm differs from the selection sort algorithm in partitioning lists. (4 marks) ©) List out the THREE (3) operations that make up the most running time in sorting algorithm, (3 marks) 4) Given the following list, show steps to sort the list by using Merge Sort. 8, 4, 6,9, 2,3,4 (6 marke) €) Given the following list, iltustrate how Insertion sort is done. 64, 26, 93, 17, 77, 31, 44, 65, 20 (4 marks) QUESTION 4 8) Define successor and predecessor in binary tree. (3 marks) b) Briefly describe the TWO (2) types of rotation in AVL tree. (3 marks) (© Hak Cipta Universiti Teknologi MARA CONFIDENTIALCONFIDENTIAL 5 CSIDEC 2018/CSC508/518 ©) Write an algorithm for post order traversal. (4 marks) d) Given the following lists, construct an AVL tree with the balance factor after each insertion. 322, 229, 656, 767, 888, 311, 201, 760, 995, 898 (5 marks) QUESTION 5 a) Table 1 shows the weight of edges and the adjacent nodes for nodes labeled A through F. Draw an undirected graph based on Table 1 (6 marks) Node ‘Adjacent nodes Weighis K (CO) (0, 8) B (A, C, F) (10, 7, 2) c (A,B, DE) 6.7, 12, 16) D (C,E, F) (12, 9, 5) E (C, D) (6,9) F (B,D) (2,5) Tabie 1 b) Using Kruskal's Algorithm, find the minimum spanning tree for the graph in Figure 3. (10 marks) | Figure 3 CONFIDENTIAL @ Hak Cipta Universiti Teknologi MARACONFIDENTIAL 6 CSIDEC 2018/CSC508/518 ©) Using Djikstra Algorithm, find the shortest path from A to all other vertices for the graph in Figure 4. (10 marks) END OF QUESTION PAPER (© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL,
You might also like
Itt459 Individual Assignment
PDF
No ratings yet
Itt459 Individual Assignment
28 pages
CSC508 - Test1 - 05dec2022 Answer Scheme PDF
PDF
No ratings yet
CSC508 - Test1 - 05dec2022 Answer Scheme PDF
8 pages
Quiz 1 With Answer Sta116 Quiz 1
PDF
100% (1)
Quiz 1 With Answer Sta116 Quiz 1
8 pages
CSC577 - STR (Izzaty, Izzatun, Han, Faisal, Zulaikha)
PDF
No ratings yet
CSC577 - STR (Izzaty, Izzatun, Han, Faisal, Zulaikha)
19 pages
ITT400 - Introduction To Data Communication and Networking: Universiti Teknologi MARA
PDF
No ratings yet
ITT400 - Introduction To Data Communication and Networking: Universiti Teknologi MARA
3 pages
Study Plan For BCS Batch 201
PDF
No ratings yet
Study Plan For BCS Batch 201
3 pages
F4 Final Report
PDF
100% (2)
F4 Final Report
12 pages
CSC186 Project Proposal
PDF
No ratings yet
CSC186 Project Proposal
3 pages
Hangman Documentation
PDF
0% (1)
Hangman Documentation
2 pages
Csc577 SRA 4c Group2
PDF
No ratings yet
Csc577 SRA 4c Group2
17 pages
Csc577 Srs 4c Group2
PDF
100% (1)
Csc577 Srs 4c Group2
31 pages
CSC508 TEST2 16jan2023
PDF
No ratings yet
CSC508 TEST2 16jan2023
4 pages
Hangman Game: Vocabulary Building Flutter App: 1) Background/ Problem Statement
PDF
No ratings yet
Hangman Game: Vocabulary Building Flutter App: 1) Background/ Problem Statement
7 pages
CSC508 TEST2 12july2023
PDF
No ratings yet
CSC508 TEST2 12july2023
4 pages
Ict551 (Proposal) - Cambridge Sport Application
PDF
No ratings yet
Ict551 (Proposal) - Cambridge Sport Application
7 pages
CSC404 Exam 1
PDF
No ratings yet
CSC404 Exam 1
5 pages
Csc577 SDD 4c Group2
PDF
100% (1)
Csc577 SDD 4c Group2
45 pages
Final Report Csc248
PDF
No ratings yet
Final Report Csc248
38 pages
Answer Scheme Isp500 Jan 2023
PDF
No ratings yet
Answer Scheme Isp500 Jan 2023
4 pages
Nurulnazifarais Isp542 Part A
PDF
No ratings yet
Nurulnazifarais Isp542 Part A
3 pages
Universiti Teknologi Mara Test 2
PDF
No ratings yet
Universiti Teknologi Mara Test 2
8 pages
Csc186topic 1 - Part2
PDF
No ratings yet
Csc186topic 1 - Part2
34 pages
Itt400 Test 1 Mar 2022 Aug 2022
PDF
No ratings yet
Itt400 Test 1 Mar 2022 Aug 2022
13 pages
Report Gui Cinema Ticketing System Csc435 Rcs2402a
PDF
No ratings yet
Report Gui Cinema Ticketing System Csc435 Rcs2402a
39 pages
Final Report Csc510 Group Mini Project
PDF
No ratings yet
Final Report Csc510 Group Mini Project
19 pages
Assignment2 Ict500
PDF
0% (2)
Assignment2 Ict500
29 pages
ICT501 Database Management Systems 6 - Bachelors Degree
PDF
No ratings yet
ICT501 Database Management Systems 6 - Bachelors Degree
7 pages
Mini Project C++ UITM
PDF
No ratings yet
Mini Project C++ UITM
12 pages
Test 1csc508 Answer
PDF
No ratings yet
Test 1csc508 Answer
7 pages
Universiti Teknologi Mara: Confidential CS/TEST 1/NOV2020/CSC583
PDF
100% (1)
Universiti Teknologi Mara: Confidential CS/TEST 1/NOV2020/CSC583
15 pages
CSC264 PROPOSAL GROUP PROJECT
PDF
No ratings yet
CSC264 PROPOSAL GROUP PROJECT
25 pages
Contoh Muka Depan
PDF
No ratings yet
Contoh Muka Depan
2 pages
CSC204 Test Oct20-Feb21
PDF
No ratings yet
CSC204 Test Oct20-Feb21
14 pages
CSC577 (Test2) - 20222 20220620
PDF
No ratings yet
CSC577 (Test2) - 20222 20220620
3 pages
Nur Ainina Najwa BT Zamzuri - Test 2
PDF
No ratings yet
Nur Ainina Najwa BT Zamzuri - Test 2
12 pages
CSC584 Storyboard D'JIA
PDF
No ratings yet
CSC584 Storyboard D'JIA
15 pages
Isp 550 Use Case Descriptin
PDF
No ratings yet
Isp 550 Use Case Descriptin
9 pages
Individual Assignment: Visualization 1
PDF
No ratings yet
Individual Assignment: Visualization 1
5 pages
ITT420 TEST1 2020-Hidayah
PDF
No ratings yet
ITT420 TEST1 2020-Hidayah
3 pages
Project OOSAD
PDF
No ratings yet
Project OOSAD
19 pages
ELC550 Annotated Biblography (Sample Article and Question)
PDF
No ratings yet
ELC550 Annotated Biblography (Sample Article and Question)
2 pages
Individual Assignment - LAN Proposal ITT459
PDF
0% (1)
Individual Assignment - LAN Proposal ITT459
5 pages
Dfc2033 Lab Activity
PDF
No ratings yet
Dfc2033 Lab Activity
9 pages
ICT450
PDF
No ratings yet
ICT450
6 pages
CSC301 - Project Proposal Cinema Ticketing System
PDF
No ratings yet
CSC301 - Project Proposal Cinema Ticketing System
19 pages
APR11 Om Uitm
PDF
No ratings yet
APR11 Om Uitm
6 pages
Uitm Mat523 Feb2022 Final
PDF
No ratings yet
Uitm Mat523 Feb2022 Final
18 pages
Test Ads460
PDF
No ratings yet
Test Ads460
3 pages
Isp500 Project Proposal (Cafe Ordering System)
PDF
No ratings yet
Isp500 Project Proposal (Cafe Ordering System)
12 pages
Stat Project
PDF
No ratings yet
Stat Project
4 pages
ICT450 Group Project Report
PDF
No ratings yet
ICT450 Group Project Report
22 pages
Individual Project Report CSC264
PDF
No ratings yet
Individual Project Report CSC264
9 pages
Isp542 Part A
PDF
No ratings yet
Isp542 Part A
3 pages
IMD261 Assignment
PDF
No ratings yet
IMD261 Assignment
1 page
Learner Profile - Group 3
PDF
No ratings yet
Learner Profile - Group 3
6 pages
Final Report Isp543
PDF
No ratings yet
Final Report Isp543
41 pages
Assignment 3 (Compiled)
PDF
No ratings yet
Assignment 3 (Compiled)
10 pages
CSC508 (1)
PDF
No ratings yet
CSC508 (1)
7 pages
Universiti Teknologi Mara Final Examination: Confidential CS/APR 2010/CSC508/518
PDF
No ratings yet
Universiti Teknologi Mara Final Examination: Confidential CS/APR 2010/CSC508/518
7 pages
Data Structure_4th_2023-2024
PDF
No ratings yet
Data Structure_4th_2023-2024
3 pages