You are on page 1of 14

Computer Science

& IT

Algorithms

Comprehensive Theory
with Solved Examples and Practice Questions

Publications
Publications

MADE EASY Publications Pvt. Ltd.


Corporate Office: 44-A/4, Kalu Sarai (Near Hauz Khas Metro Station), New Delhi-110016
E-mail: infomep@madeeasy.in
Contact: 011-45124660, 8860378007
Visit us at: www.madeeasypublications.org

Algorithms
© Copyright by MADE EASY Publications Pvt. Ltd.
All rights are reserved. No part of this publication may be reproduced, stored in or introduced
into a retrieval system, or transmitted in any form or by any means (electronic, mechanical,
photo-copying, recording or otherwise), without the prior written permission of the above
mentioned publisher of this book.

First Edition: 2015


Second Edition : 2016
Third Edition : 2017
Fourth Edition : 2018
Fifth Edition : 2019
Sixth Edition : 2020
Seventh Edition : 2021

© All rights reserved by MADE EASY PUBLICATIONS Pvt. Ltd. No part of this book may be reproduced or utilized in any form without
the written permission from the publisher.
Contents
Algorithms

Chapter 1 Chapter 4
Asymptotic Analysis of Algorithms����������� 3 Greedy Techniques�����������������������������������������90
1.1 Need for Performance Analysis.................................. 3 4.1 Introduction.....................................................................90
1.2 Worst, Average and Best Cases................................... 4 4.2 Basic Examples of Greedy Techniques...................91
1.3 Asymptotic Notations.................................................... 5 4.3 Greedy Technique Formalization.............................92
1.4 Analysis of Loops............................................................. 9 4.4 Knapsack (Fractional) Problem.................................93
1.5 Comparisons of Functions..........................................19 4.5 Representations of Graphs.........................................96
1.6 Asymptotic Behaviour of Polynomials...................20 4.6 Minimum Cost Spanning Tree (MCST) Problem.....98
Student Assignments.................................................................23 4.7 Single Source Shortest Path Problem (SSSPP)...... 107
4.8 Huffman Coding.......................................................... 117

Chapter 2 Student Assignments............................................................... 121

Recurrence Relations������������������������������31
2.1 Introduction.....................................................................31 Chapter 5
2.2 Substitution Method....................................................32 Graph Based Algorithms......................139
2.3 Master Theorem.............................................................43 5.1 Introduction.................................................................. 139
Student Assignments..................................................................46 5.2 Graph Searching......................................................... 139
5.3 Directed Acyclic Graphs (DAG).............................. 151
Chapter 3 5.4 Topological Sorting.................................................... 152

Divide and Conquer�������������������������������55 Student Assignments............................................................... 155

3.1 Introduction.....................................................................55
3.2 Quick Sort.........................................................................55 Chapter 6
3.3 Strassen’s Matrix Multiplication................................60 Dynamic Programing...........................163
3.4 Merge Sort........................................................................63 6.1 Introduction.................................................................. 163

3.5 Insertion Sort...................................................................66 6.2 Fibonacci Numbers.................................................... 163


6.3 All-Pairs Shortest Paths Problem........................... 166
3.6 Counting Inversions......................................................67
6.4 Matrix Chain Multiplication..................................... 170
3.7 Binary Search...................................................................69
6.5 The 0/1 Knapsack Problem...................................... 183
3.8 Bubble Sort......................................................................72
6.6 Multistage Graph........................................................ 187
3.9 Finding Min and Max....................................................73 6.7 Traveling-Salesman Problem.................................. 189
3.10 Power of An Element....................................................76 Student Assignments.................................................. 192
Student Assignments..................................................................78

nnnn

(iii)

You might also like