PHP 7 Data Structures and Algorithms

Increase your productivity by implementing data structures
Preview in Mapt

PHP 7 Data Structures and Algorithms

Mizanur Rahman

1 customer reviews
Increase your productivity by implementing data structures
Mapt Subscription
FREE
$29.99/m after trial
eBook
$10.00
RRP $35.99
Save 72%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$10.00
$44.99
$29.99 p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


PHP 7 Data Structures and Algorithms Book Cover
PHP 7 Data Structures and Algorithms
$ 35.99
$ 10.00
Learning JavaScript Data Structures and Algorithms - Third Edition Book Cover
Learning JavaScript Data Structures and Algorithms - Third Edition
$ 35.99
$ 10.00
Buy 2 for $20.00
Save $51.98
Add to Cart

Book Details

ISBN 139781786463890
Paperback300 pages

Book Description

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

Chapter 1: Introduction to Data Structures and Algorithms
Importance of data structures and algorithms
Understanding Abstract Data Type (ADT)
Different data structures
Solving a problem - algorithmic approach
Writing pseudocode
Algorithm analysis
Understanding the big O (big oh) notation
Standard PHP Library (SPL) and data structures
Summary
Chapter 2: Understanding PHP Arrays
Understanding PHP arrays in a better way
Using an array as flexible storage
Use of multi-dimensional arrays to represent data structures
Performance comparison between a regular PHP array and SplFixedArray
Understanding hash tables
Implementing struct using a PHP array
Implementing sets using a PHP array
Best usage of a PHP array
PHP array, is it a performance killer?
Summary
Chapter 3: Using Linked Lists
What is a linked list?
Different types of linked list
Inserting, deleting, and searching for an item
Understanding complexity for linked lists
Making the linked list iterable
Building circular linked list
Implementing a doubly linked list in PHP
Doubly linked list operations
Complexity for doubly linked lists
Using PHP SplDoublyLinkedList
Summary
Chapter 4: Constructing Stacks and Queues
Understanding stack
Implementing a stack using PHP array
Understanding complexity of stack operations
Implementing stack using linked list
Using SplStack class from SPL
Real life usage of stack
Understanding queue
Using SplQueue class from SPL
Understanding priority queue
Implementing priority queue using linked list
Implement a priority queue using SplPriorityQueue
Implementing a circular queue
Creating a double - ended queue (deque)
Summary
Chapter 5: Applying Recursive Algorithms - Recursion
Understanding recursion
Different types of recursions
Building an N-level category tree using recursion
Finding files and directories using recursion
Analyzing recursive algorithms
Maximum recursion depth in PHP
Using SPL recursive iterators
Using the PHP built-in function array_walk_recursive
Summary
Chapter 6: Understanding and Implementing Trees
Tree definition and properties
Implementing a tree using PHP
Different types of tree structures
Understanding a binary tree
Implementing a binary tree
Creating a binary tree using a PHP array
Understanding the binary search tree
Constructing a binary search tree
Tree traversal
Complexity of different tree data structures
Summary
Chapter 7: Using Sorting Algorithms
Understanding sorting and their types
Understanding bubble sort
Understanding selection sort
Understanding insertion Sort
Understanding divide-and-conquer technique for sorting
Understanding merge sort
Understanding quick sort
Understanding bucket sort
Using PHP's built-in sorting function
Summary
Chapter 8: Exploring Search Options
Linear searching
Binary search
Interpolation search
Exponential search
Search using hash table
Tree searching
Summary
Chapter 9: Putting Graphs into Action
Understanding graph properties
Types of graphs
Revisiting BFS and DFS for graphs
Topological sorting using Kahn's algorithm
Shortest path using the Floyd-Warshall algorithm
Single source shortest path using Dijkstra's algorithm
Finding the shortest path using the Bellman-Ford algorithm
Understanding the minimum spanning tree (MST)
Implementing Prim's spanning tree algorithm
Kruskal's algorithm for spanning tree
Summary
Chapter 10: Understanding and Using Heaps
What is a heap?
Heap operations
Implementing a binary heap in PHP
Analyzing the complexity of heap operations
Using heaps as a priority queue
Using heap sort
Using SplHeap, SplMaxHeap, and SplMinHeap
Summary
Chapter 11: Solving Problems with Advanced Techniques
Memoization
Pattern matching algorithms
Implementing Knuth-Morris-Pratt algorithm
Greedy algorithms
Implementing Huffman coding algorithm
Understanding dynamic programming
0 - 1 knapsack
Finding the longest common subsequence-LCS
DNA sequencing using dynamic programming
Backtracking to solve puzzle problem
Collaborative filtering recommendation system
Using bloom filters and sparse matrix
Summary
Chapter 12: PHP Built-In Support for Data Structures and Algorithms
Built-in PHP features for data structure
SPL classes
Built-in PHP algorithms
Hashing
Built-in support through PECL
Vector
Chapter 13: Functional Data Structures with PHP
Understanding functional programming with PHP
Getting started with Tarsana
Implementing stack
Implementing a queue
Implementing a tree
Summary

What You Will Learn

  • Gain a better understanding of PHP arrays as a basic data structure and their hidden power
  • Grasp how to analyze algorithms and the Big O Notation
  • Implement linked lists, double linked lists, stack, queues, and priority queues using PHP
  • Work with sorting, searching, and recursive algorithms
  • Make use of greedy, dynamic, and pattern matching algorithms
  • Implement tree, heaps, and graph algorithms
  • Apply PHP functional data structures and built-in data structures and algorithms

Authors

Table of Contents

Chapter 1: Introduction to Data Structures and Algorithms
Importance of data structures and algorithms
Understanding Abstract Data Type (ADT)
Different data structures
Solving a problem - algorithmic approach
Writing pseudocode
Algorithm analysis
Understanding the big O (big oh) notation
Standard PHP Library (SPL) and data structures
Summary
Chapter 2: Understanding PHP Arrays
Understanding PHP arrays in a better way
Using an array as flexible storage
Use of multi-dimensional arrays to represent data structures
Performance comparison between a regular PHP array and SplFixedArray
Understanding hash tables
Implementing struct using a PHP array
Implementing sets using a PHP array
Best usage of a PHP array
PHP array, is it a performance killer?
Summary
Chapter 3: Using Linked Lists
What is a linked list?
Different types of linked list
Inserting, deleting, and searching for an item
Understanding complexity for linked lists
Making the linked list iterable
Building circular linked list
Implementing a doubly linked list in PHP
Doubly linked list operations
Complexity for doubly linked lists
Using PHP SplDoublyLinkedList
Summary
Chapter 4: Constructing Stacks and Queues
Understanding stack
Implementing a stack using PHP array
Understanding complexity of stack operations
Implementing stack using linked list
Using SplStack class from SPL
Real life usage of stack
Understanding queue
Using SplQueue class from SPL
Understanding priority queue
Implementing priority queue using linked list
Implement a priority queue using SplPriorityQueue
Implementing a circular queue
Creating a double - ended queue (deque)
Summary
Chapter 5: Applying Recursive Algorithms - Recursion
Understanding recursion
Different types of recursions
Building an N-level category tree using recursion
Finding files and directories using recursion
Analyzing recursive algorithms
Maximum recursion depth in PHP
Using SPL recursive iterators
Using the PHP built-in function array_walk_recursive
Summary
Chapter 6: Understanding and Implementing Trees
Tree definition and properties
Implementing a tree using PHP
Different types of tree structures
Understanding a binary tree
Implementing a binary tree
Creating a binary tree using a PHP array
Understanding the binary search tree
Constructing a binary search tree
Tree traversal
Complexity of different tree data structures
Summary
Chapter 7: Using Sorting Algorithms
Understanding sorting and their types
Understanding bubble sort
Understanding selection sort
Understanding insertion Sort
Understanding divide-and-conquer technique for sorting
Understanding merge sort
Understanding quick sort
Understanding bucket sort
Using PHP's built-in sorting function
Summary
Chapter 8: Exploring Search Options
Linear searching
Binary search
Interpolation search
Exponential search
Search using hash table
Tree searching
Summary
Chapter 9: Putting Graphs into Action
Understanding graph properties
Types of graphs
Revisiting BFS and DFS for graphs
Topological sorting using Kahn's algorithm
Shortest path using the Floyd-Warshall algorithm
Single source shortest path using Dijkstra's algorithm
Finding the shortest path using the Bellman-Ford algorithm
Understanding the minimum spanning tree (MST)
Implementing Prim's spanning tree algorithm
Kruskal's algorithm for spanning tree
Summary
Chapter 10: Understanding and Using Heaps
What is a heap?
Heap operations
Implementing a binary heap in PHP
Analyzing the complexity of heap operations
Using heaps as a priority queue
Using heap sort
Using SplHeap, SplMaxHeap, and SplMinHeap
Summary
Chapter 11: Solving Problems with Advanced Techniques
Memoization
Pattern matching algorithms
Implementing Knuth-Morris-Pratt algorithm
Greedy algorithms
Implementing Huffman coding algorithm
Understanding dynamic programming
0 - 1 knapsack
Finding the longest common subsequence-LCS
DNA sequencing using dynamic programming
Backtracking to solve puzzle problem
Collaborative filtering recommendation system
Using bloom filters and sparse matrix
Summary
Chapter 12: PHP Built-In Support for Data Structures and Algorithms
Built-in PHP features for data structure
SPL classes
Built-in PHP algorithms
Hashing
Built-in support through PECL
Vector
Chapter 13: Functional Data Structures with PHP
Understanding functional programming with PHP
Getting started with Tarsana
Implementing stack
Implementing a queue
Implementing a tree
Summary

Book Details

ISBN 139781786463890
Paperback300 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

PHP Microservices Book Cover
PHP Microservices
$ 35.99
$ 10.00
Domain-Driven Design in PHP Book Cover
Domain-Driven Design in PHP
$ 39.99
$ 10.00
PHP 7: Real World Application Development Book Cover
PHP 7: Real World Application Development
$ 69.99
$ 10.00
Python Data Structures and Algorithms Book Cover
Python Data Structures and Algorithms
$ 35.99
$ 10.00
Mastering Bootstrap 4 Book Cover
Mastering Bootstrap 4
$ 35.99
$ 10.00
Learning Vue.js 2 Book Cover
Learning Vue.js 2
$ 35.99
$ 10.00