Data Structure and Algorithms

Total Page:16

File Type:pdf, Size:1020Kb

Data Structure and Algorithms

Data Structure and Algorithms

Semester III - Information Technology (Mumbai University)

Bhakti Raul-Palkar Vinaya M. Rawool M.E. Computer Engineeering M.E. Computer Engineeering Formerly Lecturer, Formerly Lecturer, Department of Computer Engineering, Department of Computer Engineering, K J Somaiya College of Engineering, K J Somaiya College of Engineering, Mumbai. Mumbai. Data Structure and Algorithms Bhakti Raul-Palkar, Vinaya M. Rawool (Semester III – Information Technology, Mumbai University)

Copyright © by Tech-Max Publications. All rights reserved. No part of this publication may be reproduced, copied, or stored in a retrieval system, distributed or transmitted in any form or by any means, including photocopy, recording, or other electronic or mechanical methods, without the prior written permission of the publisher.

This book is sold subject to the condition that it shall not, by the way of trade or otherwise, be lent, resold, hired out, or otherwise circulated without the publisher’s prior written consent in any form of binding or cover other than which it is published and without a similar condition including this condition being imposed on the subsequent purchaser and without limiting the rights under copyright reserved above.

First Edition : September 2008 Second Revised Edition : September 2009 Third Revised Edition : June 2010

This edition is for sale in India, Bangladesh, Bhutan, Maldives, Nepal, Pakistan, Sri Lanka and designated countries in South-East Asia. Sale and purchase of this book outside of these countries is unauthorized by the publisher. Printed at : Image Offset, Survey No. 10/1/1, Dhayari Gaon, Near Kailas Jeevan Factory, Pune – 41,Maharashtra State, India. Phone : 020 – 24392059

ISBN : 978-81-8407-972-2

Published by Tech-Max Publications Head Office : B/5, First floor, Maniratna Complex, Taware Colony, Aranyeshwar Corner, Pune - 411 009. Maharashtra State, India Ph : 91-20-24225065, 91-20-24217965. Fax 020-24228978. Email : [email protected], Website : www.techmaxbooks.com

(Tech-Max Book Code : M98) Price Rs. 635/- Syllabus

1. Revisiting Java programming construct : Classes types, and objects , Methods, Expressions, Control flow, Arrays, input and output, Packages, Utilities in the java lang package. (Refer Chapter 1) 2. Object Oriented Design & Analysis of Algorithms Inheritance, and polymorphism, Exceptions, Interfaces, Abstract Classes, and Casting, Recursion and Other Design patterns , Pseudo – Code, Simple justification Techniques Measures algorithmic complexity, Space complexity, Time complexity, Some mathematics needed in measuring complexity, The big O-notation used in measuring complexity. (Refer Chapter 2) 3. Stacks, Queues, and Recursion : Recursion, Stacks, Queues, Linked Lists, Double – ended Queues. (Refer Chapter 3) 4. Vectors, Lists, and Sequences : Vectors and Array Lists , Lists, Sequences , Favorite lists and the move – to Front Heuristic. (Refer Chapter 4) 5. Trees : The tree Abstract Data Type, basic Algorithms on Tree, binary Tree, data Structures for representing Tree. (Refer Chapter 5) 6. Priority queues : The priority queues Abstract data Type, Implementing a Priority queues with a List Heaps, Adaptable priority queues (Refer Chapter 6) 7. Maps and dictionaries : The Map Abstract data Type, Hahs Tables, The dictionary data Type, Skip Lists, Extensions and Applications for dictionaries. (Refer Chapter 7) 8. Search Trees : Binary Search Trees, AVL Trees, Splay Trees, (2,4) Trees, Red – Black Trees, External searching in B-Trees. (Refer Chapter 8) 9. Sorting sets, and selection : Merge Sort, Heap Sort, Quick Sort, and A Lower Bound on comparison – Based Sorting BUCKET Sort and radix Sort, the complexity of some sorting algorithms , comparison of Sorting Algorithms , The Set ADT and union / file Structures (Refer Chapter 9) 10. Text Processing : String operations, Pattern Matching Algorithms, Tries, Text compression, Text similarity Testing. (Refer Chapter 10) 11. Graphs : The graph Abstract Data Type , Data Structures for Graphs , Graph Traversals Directed Graphs, Weighted Graphs, Shortest Paths, Minimum spanning Trees. (Refer Chapter 11)  Preface

This book introduces abstract concepts of “Data Structure and Algorithms”, shows how those concepts are useful in problem solving, and then shows how the abstractions can be made concrete by using a programming language. The language used in this text is ‘Java’. All the programs and algorithms in his book have been tested and debugged.

Chapter 1 is revision of some of the important concepts of ‘Java’ which are used in developing programs.

Chapter 2 discusses object oriented analysis and design concepts. It also explains measures for space and time complexity.

Chapter 3 introduces stack, queue and linked list concepts.

Chapter 4 discusses vector, array list, list and sequences.

Chapter 5 discusses tree, types of trees, binary tree operations, applications, representation, traversal and implementation.

Chapter 6 discusses priority queue and its implementation using array, linked list and heap. It also introduces adaptable priority queue,

Chapter 7 introduces map, hash table, skip list and their applications.

Chapter 8 introduces binary search tree, AVL trees, splay trees, red-black trees and 2-4 trees.

Chapter 9 introduces searching and sorting techniques and also compares them.

Chapter 10 discusses String operations, Pattern Matching Algorithms, Tries, Text compression and Text similarity testing algorithms.

Chapter 11 discusses Graphs, types of graphs, Graph Traversals techniques, Minimum spanning Trees and shortest path algorithms.

The book is an outcome of the honest efforts made to simplify many complex, hard to understand concepts of data structure.

Bhakti Raul-Palkar ([email protected])

Vinaya Rawool ([email protected]) Acknowledgement

Writing a book is a project and reflects the contribution of many people. Here we want to acknowledge and give special thanks to those who contributed the most.

This book was reviewed by Mr. Zamir Sayyed, Associate Technical Evangelist, Education and Research Department, Infosys, Pune. We thank the reviewer for his constructive comments and encouragement.

We convey our sincere thanks to Dr. P.P. Parikh, Director, K J Somaiya college of Engineering, Dr. Medha Dixit, principle, K J Somaiya college of Engineering, and Prof. Deepak Sharma and Prof. Uday Joshi, K J Somaiya College of Engineering, for their warm encouragement and support.

We are thankful to Mr. Pradeep Lunawat and Mr. Sachin Shah for the encouragement and support that they have extended. We are also thankful to the staff members of Tech-Max Publications and others for their efforts to make this book as good as it is.

Despite the assistance of so many people and our own best efforts, there are still likely to be some unintentional omissions or errors. We would therefore highly appreciate any useful suggestions and corrections from the reader.

– Prof. Bhakti C. Raul ([email protected]) - Prof. Vinaya M. Rawool ([email protected])

 Dedicated to………

……..Authors

Recommended publications