An Elementary Approach to Design and Analysis of Algorithms
eBook - ePub

An Elementary Approach to Design and Analysis of Algorithms

Lekh Raj Vermani, Shalini Vermani

Compartir libro
  1. 536 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

An Elementary Approach to Design and Analysis of Algorithms

Lekh Raj Vermani, Shalini Vermani

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

In computer science, an algorithm is an unambiguous specification of how to solve a class of problems. Algorithms can perform calculation, data processing and automated reasoning tasks.

As an effective method, an algorithm can be expressed within a finite amount of space and time and in a well-defined formal language for calculating a function. Starting from an initial state and initial input (perhaps empty), the instructions describe a computation that, when executed, proceeds through a finite number of well-defined successive states, eventually producing 'output' and terminating at a final ending state. The transition from one state to the next is not necessarily deterministic; some algorithms, known as randomized algorithms, incorporate random input.

This book introduces a set of concepts in solving problems computationally such as Growth of Functions; Backtracking; Divide and Conquer; Greedy Algorithms; Dynamic Programming; Elementary Graph Algorithms; Minimal Spanning Tree; Single-Source Shortest Paths; All Pairs Shortest Paths; Flow Networks; Polynomial Multiplication, to ways of solving NP-Complete Problems, supported with comprehensive, and detailed problems and solutions, making it an ideal resource to those studying computer science, computer engineering and information technology.

Contents:

  • Preface
  • About the Authors
  • Algorithms
  • Growth of Functions
  • Backtracking
  • Divide and Conquer
  • Greedy Algorithms
  • Dynamic Programming
  • Elementary Graph Algorithms
  • Minimal Spanning Tree
  • Single-Source Shortest Paths
  • All Pairs Shortest Paths
  • Flow Networks
  • Polynomial Multiplication, FFT and DFT
  • String Matching
  • Sorting Networks
  • NP-Complete Problems
  • Bibliography
  • Index


Readership: Students studying for degrees in computer science, computer engineering and information technology.Algorithms;Computer Science;Computer Engineering;Information Technology00

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es An Elementary Approach to Design and Analysis of Algorithms un PDF/ePUB en línea?
Sí, puedes acceder a An Elementary Approach to Design and Analysis of Algorithms de Lekh Raj Vermani, Shalini Vermani en formato PDF o ePUB, así como a otros libros populares de Computer Science y Programming Algorithms. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Editorial
WSPC (EUROPE)
Año
2019
ISBN
9781786346773

Chapter 1

Algorithms

In the subject of computer science the word algorithm, in general, refers to a method that can be used by a computer for the solution of a problem. As such the word algorithm does not simply mean a process, technique or method. Strictly speaking, it is a finite collection of well-defined computational techniques each of which is clear and unambiguous, capable of being performed with finite effort and terminates in a finite amount of time. Before an algorithm comes to play, a problem to be solved on computer is first converted into a mathematical problem called mathematical model. An algorithm is different from a program (computer program). Although algorithm is an easily understood procedure giving a set of logical instructions for solving the problem at hand, a program is written in a computer language giving the instructions that the computer understands.

1.1.Some Sorting Algorithms

We begin our study of algorithms by considering some sorting algorithms. Here we are given a sequence of non-negative integers a1, a2, . . . , an, not necessarily all distinct, the aim is to obtain a permutation of the a’s to get the numbers in a non-decreasing (or non-increasing) order i.e., to obtain a sequence a1′, a2′, . . . , an with {a1′, a2′, . . . , an} = {a1, a2, . . . , an} and a1′a2′
image
an. We restrict ourselves to obtaining a non-decreasing sequence.

1.1.1.Bubble sort

Among the sorting algorithms, this is most perhaps the easiest. In this algorithm an is first compared with an–1 and if an < an–1, an and an–1 are interchanged. Then an is compared with an–2 and if an < an–2, an and an–2 are interchanged and the process stops when we come to an ai such that ai < an. The process is then followed with an–1, then an–2 etc.
Algorithm 1.1. Bubble Sort Algorithm
1.For i = 1 to n − 1, do
2.forj = n to i + 1
3.if aj < aj–1, then
4.interchange (swap) ajaj–1
We will better explain this algorithm through two examples: one a sequence with all terms distinct and the other when all the terms are not necessarily distinct. We may not restrict ourselves to sequences of numbers alone but may consider sequences over any ordered set.
Example 1.1. Using bubble sort, rearrange the sequence
image
in alphabetical order.
Solution. This is a sequence of six terms all distinct. So i takes the values from 1 to 5. We express the sequence as a column denoting each word by the first letter of the word. We shall fully describe the internal loops for every i (refer to Table 1.1).
Observe that in the case i = 1, there is no change for j = 5, in the case of i = 2, there is no change for j = 6, 5, 4 and for i = 3, there is no change for j = 6, 5. At this stage the sequence is already sorted and, so, for i = 4 and 5, no changes are required. Hence the final sorted sequence is A, E, K, P, S, V or
image
Example 1.2. Using bubble sort, rearrange the sequence 2, 3, 6, 1, 0, 4, 8, 0 in non-decreasing order.
Table 1.1
image
Table 1.2(a)
image
Table 1.2(b)
image
Solution. This is a sequence of eight terms. So i takes values from 1 to 7. We express the sequence as a column and fully describe the internal loops for every i (as given in Tables 1.2(a) and 1.2(b)).
Observe that the array obtained in the last column of Table 1.2(b) is already sorted and, so, no changes are needed for i = 5, 6, 7. Also on the way, no changes were needed for i =...

Índice