Book Image

PHP 7 Data Structures and Algorithms

By : Mizanur Rahman
5 (1)
Book Image

PHP 7 Data Structures and Algorithms

5 (1)
By: Mizanur Rahman

Overview of this book

PHP has always been the the go-to language for web based application development, but there are materials and resources you can refer to to see how it works. Data structures and algorithms help you to code and execute them effectively, cutting down on processing time significantly. If you want to explore data structures and algorithms in a practical way with real-life projects, then this book is for you. The book begins by introducing you to data structures and algorithms and how to solve a problem from beginning to end using them. Once you are well aware of the basics, it covers the core aspects like arrays, listed lists, stacks and queues. It will take you through several methods of finding efficient algorithms and show you which ones you should implement in each scenario. In addition to this, you will explore the possibilities of functional data structures using PHP and go through advanced algorithms and graphs as well as dynamic programming. By the end, you will be confident enough to tackle both basic and advanced data structures, understand how they work, and know when to use them in your day-to-day work
Table of Contents (14 chapters)

What this book covers

Chapter 1, Introduction to Data Structures and Algorithms, focuses on different data structures, their definitions, properties, and examples. This chapter also includes the way in which we analyze algorithms and find their complexities, with special emphasis on Big Oh (O) notation.

Chapter 2, Understanding PHP Arrays, focuses on a very basic and built-in data structure in PHP -- PHP arrays. This also covers what we can achieve through PHP arrays and their advantages and disadvantages. We focus on how to use arrays to implement other data structures.

Chapter 3, Using Linked Lists, covers the different types of linked lists. It focuses on the classification of different variances of linked lists and their construction process, with examples.

Chapter 4, Constructing Stacks and Queues, focuses on two of the most important data structures in this chapter--stacks and queues. We see how to construct stacks and queues using different methods and discuss their operation and usage with examples. 

Chapter 5, Applying Recursive Algorithms - Recursion, focuses on one important topic with algorithms--recursion. We cover the different ways in which we can solve a problem using recursive algorithms and the advantages and disadvantages of using this technique. We also cover some basic day-to-day programming problems that we can solve using recursion.

Chapter 6, Understanding and Implementing Trees, talks about a non-hierarchical data structure--the tree. We cover tree properties and how to construct them, and understand the cases in which the tree data structure will be important to us.

Chapter 7, Using Sorting Algorithms, demonstrates how to implement different sorting algorithms and their complexity, as sorting is a very important topic in the programming world and the search for an efficient sorting algorithm is always on. At the end of the chapter, we also cover the built-in PHP sorting algorithms.

Chapter 8, Exploring Search Options, states how searching is important in the programming world. In this chapter, we focus on different searching techniques and when to use which algorithms. We also discuss whether we should sort before searching. This chapter contains lots of examples and implementations of different algorithms.

Chapter 9, Putting Graphs into Action, explains how graph algorithms are one of the most widely used algorithms in the programming paradigm. In this chapter, we focus on different graph-related problems and solve them using different algorithms. We cover implementations of the shortest path algorithm and minimal spanning trees with examples and explanations.

Chapter 10, Understanding and Using Heaps, talks about the last data structure topic in the book--the heap. It is a very efficient data structure and is used in many implementations in the real world. We show how to build heaps and their uses, including the implementations of the heap sort algorithm. 

Chapter 11, Solving Problems with Advanced Techniques, focuses on different techniques to solve problems. We focus our discussion on topics such as memoization, dynamic programming, greedy algorithms, and backtracking, along with examples and solutions for practical problems.

Chapter 12, PHP’s Built-In Support for Data Structures and Algorithms, shows the built-in support we have for data structures and algorithms. We talk about PHP’s functions, PECL libraries, and also some references for online resources.

Chapter 13, Functional Data Structures with PHP, sheds some light on functional programming and functional data structures using PHP, as functional programming is creating a lot of hype these days. We introduce a functional programming library called Tarsana and show different examples of using it.