Sei sulla pagina 1di 22
Unit 5 snanpesssnchon! on esses a bam 5 5a ati Re AL — Tec 102 | Computing II | Data Structures os" Spenuavenart — WOU COURSE TEAM Consens Adapeer! Dr Bong Chin Wei Course Coordinator: Dt Bong Chin Wei Instructional Designer: Profesor Ng Wai Kong, ‘Academie Member: Profesor Emeritus Dato Tan Wang Seng. External Course Assesor: Professor Jimmy Lec, Chinese University of Hong Kong. PRODUCTION Inchowse Eiitor:Jesane Chow Graphic Designer: Audeey Yeong ‘Wawasan Open University is Malasiss fer private notfor-profie tertiary insticuion dedicated o sdule learners Te is fanded by the Wawasan Education Foundation, a tax exempt entity established by the Parti Gerakan Relat Malaysia and supported by the Yeap Chor Ee Charitable and Endowment Trusts, other charities, conporatons and members ofthe public, © 2007 Wawasan Open Universicy [All cights reserved, No part ofthis publication may be reproduced, stored in aretseval system or teansmitied, in any fotm or by any mesns, electronic, mechanical, phorocopying, recording or otherwise, widhoue prior written permission fiom WOU, Wawasan Open Universi 51-20 Menara BHL, Jalan Sultan Ahmad Shab, 10050 Penang. “Tel: (604) 2289323. Fax: (604) 2269323 Email: enquiry@wou.edumy ‘Websice: worw.wou.edu.my ACKNOWLEDGEMENT Pablished by Wawasan Open Universyy 2007. This edition has been revised by Wawasan Open Universi fom the course MT 201 Computing Fundamentals with Jena developed by The Open University of Hong Kong wich the permission of the owner Contents Unit5 Data Structures Overview Objectives 5.1. Stack and vectors Objectives Introduction Data structures Stack A simple stack Vector Suggested answers to activities 5.2 Collections Objectives Introduction Collections in Java list An implementation: arcaylist Sets ‘What are sets? [An implementation for maintaining objects: HashSet Maps What are maps? An implementation: HashMap Choosing suitable collection types and implementations u 16 v v v v » a u u m4 6 % 2 »

Potrebbero piacerti anche