万本电子书0元读

万本电子书0元读

顶部广告

Learning JavaScript Data Structures and Algorithms - Second Edition电子书

售       价:¥

1人正在读 | 0人评论 9.8

作       者:Loiane Groner

出  版  社:Packt Publishing

出版时间:2016-06-01

字       数:234.9万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Hone your skills by learning classic data structures and algorithms in JavaScript About This Book Understand common data structures and the associated algorithms, as well as the context in which they are used. Master existing JavaScript data structures such as array, set and map and learn how to implement new ones such as stacks, linked lists, trees and graphs. All concepts are explained in an easy way, followed by examples. Who This Book Is For If you are a student of Computer Science or are at the start of your technology career and want to explore JavaScript’s optimum ability, this book is for you. You need a basic knowledge of JavaScript and programming logic to start having fun with algorithms. What You Will Learn Declare, initialize, add, and remove items from arrays, stacks, and queues Get the knack of using algorithms such as DFS (Depth-first Search) and BFS (Breadth-First Search) for the most complex data structures Harness the power of creating linked lists, doubly linked lists, and circular linked lists Store unique elements with hash tables, dictionaries, and sets Use binary trees and binary search trees Sort data structures using a range of algorithms such as bubble sort, insertion sort, and quick sort In Detail This book begins by covering basics of the JavaScript language and introducing ECMAScript 7, before gradually moving on to the current implementations of ECMAScript 6. You will gain an in-depth knowledge of how hash tables and set data structure functions, as well as how trees and hash maps can be used to search files in a HD or represent a database. This book is an accessible route deeper into JavaScript. Graphs being one of the most complex data structures you’ll encounter, we’ll also give you a better understanding of why and how graphs are largely used in GPS navigation systems in social networks. Toward the end of the book, you’ll discover how all the theories presented by this book can be applied in real-world solutions while working on your own computer networks and Facebook searches. Style and approach This book gets straight to the point, providing you with examples of how a data structure or algorithm can be used and giving you real-world applications of the algorithm in JavaScript. With real-world use cases associated with each data structure, the book explains which data structure should be used to achieve the desired results in the real world.
目录展开

Learning JavaScript Data Structures and Algorithms - Second Edition

Learning JavaScript Data Structures and Algorithms - Second Edition

Credits

About the Author

About the Reviewer

www.PacktPub.com

eBooks, discount offers, and more

Why subscribe?

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book

Errata

Piracy

Questions

1. JavaScript—A Quick Overview

JavaScript data structure and algorithms

Setting up the environment

The minimum setup to work with JavaScript

Using web servers (XAMPP)

It's all about JavaScript (Node.js)

JavaScript basics

Variables

Variable scope

Operators

Truthy and falsy

Functions of the equals operators (== and ===)

Control structures

Conditional statements

Loops

Functions

Object-oriented programming in Javascript

Debugging and tools

Introducing ECMAScript

ECMAScript 6 and ECMAScript 7

The compatibility table

Using Babel.js

ECMAScript 6 functionalities

Declaring variables with let instead of var

Variables scope with let

Constants

Template literals

Arrow functions

Default parameter values for functions

Declaring the spread and rest operators

Enhanced object properties

Object-oriented programming with classes

Inheritance

Working with getters and setters

Other functionalities

ECMAScript 7 functionalities

ES6 and ES7 backward compatibility

Summary

2. Arrays

Why should we use arrays?

Creating and initializing arrays

Accessing elements and iterating an array

Adding elements

Using the push method

Inserting an element in the first position

Using the unshift method

Removing elements

Removing an element from first position

Using the shift method

Adding and removing elements from a specific position

Two-dimensional and multidimensional arrays

Iterating the elements of two-dimensional arrays

Multi-dimensional arrays

References for JavaScript array methods

Joining multiple arrays

Iterator functions

Iterating using the every method

Iterating using the some method

Iterating using forEach

Using map and filter

Using the reduce method

ECMAScript 6 and new Array functionalities

Iterating using forEach with arrow functions

Iterating using the for...of loop

Using the new ES6 iterator (@@iterator)

Array entries, keys, and values

Using the from method

Using Array.of

Using the fill method

Using the copyWithin method

Sorting elements

Custom sorting

Sorting strings

Searching

ECMAScript 6 - the find and findIndex methods

ECMAScript 7 - using the includes method

Outputting the array into a string

The TypedArray class

Summary

3. Stacks

The stack data structure

Creating a stack

Pushing elements to the stack

Popping elements from the stack

Peeking the element from the top of the stack

Verifying if the stack is empty

Clearing and printing the elements of the stack

Using the Stack class

EcmaScript 6 and the Stack class

Declaring the Stack class using ES6 syntax

ES6 classes with scoped Symbols

ES6 classes with WeakMap

Solving problems using stacks

Decimal to binary

The base converter algorithm

Summary

4. Queues

The queue data structure

Creating a queue

Enqueue elements to the queue

Dequeue elements from the queue

Peeking the element from the front of the queue

Verifying if the queue is empty

Printing the elements of the queue

Using the Queue class

The Queue class using ECMAScript 6 syntax

The priority queue

The circular queue - Hot Potato

JavaScript task queues

Summary

5. Linked Lists

The linked list data structure

Creating a linked list

Appending elements to the end of the linked list

Removing elements from the linked list

Inserting an element at any position

Implementing other methods

The toString method

The indexOf method

The isEmpty, size, and getHead methods

Doubly linked lists

Inserting a new element at any position

Removing elements from any position

Circular linked lists

Summary

6. Sets

Structuring a dataset

Creating a set

The has (value) method

The add method

The delete and clear methods

The size method

The values method

Using the Set class

Set operations

Set union

Set intersection

Set difference

Subset

ES6 – the Set class

ES6 Set class operations

Simulating the union operation

Simulating the intersection operation

Simulating the difference operation

Summary

7. Dictionaries and Hashes

Dictionaries

Creating a dictionary

The has and set methods

The delete method

The get and values methods

The clear, size, keys, and getItems methods

Using the Dictionary class

The hash table

Creating a hash table

Using the HashTable class

Hash table versus hash set

Handling collisions between hash tables

Separate chaining

The put method

The get method

The remove method

Linear probing

The put method

The get method

The remove method

Creating better hash functions

The ES6 Map class

The ES6 WeakMap and WeakSet classes

Summary

8. Trees

The tree data structure

Tree terminology

The binary and binary search trees

Creating the BinarySearchTree class

Inserting a key into a tree

Tree traversal

In-order traversal

Pre-order traversal

Post-order traversal

Searching for values in a tree

Searching for minimum and maximum values

Searching for a specific value

Removing a node

Removing a leaf node

Removing a node with a left or right child

Removing a node with two children

Self-balancing trees

Adelson-Velskii and Landi's tree (AVL tree)

Inserting a node in the AVL tree

Calculating the balance factor

AVL rotations

Completing the insertNode method

More about binary trees

Summary

9. Graphs

Graph terminology

Directed and undirected graphs

Representing a graph

The adjacency matrix

The adjacency list

The incidence matrix

Creating the Graph class

Graph traversals

Breadth-first search (BFS)

Finding the shortest paths using BFS

Further study on the shortest paths algorithms

Depth-first search (DFS)

Exploring the DFS algorithm

Topological sorting using DFS

Shortest path algorithms

Dijkstra's algorithm

The Floyd-Warshall algorithm

Minimum spanning tree (MST)

Prim's algorithm

Kruskal's algorithm

Summary

10. Sorting and Searching Algorithms

The sorting algorithms

The bubble sort

The improved bubble sort

The selection sort

The insertion sort

The merge sort

The quick sort

The partition process

The quick sort in action

The heap sort

The counting, bucket, and radix sorts (the distribution sorts)

Searching algorithms

The sequential search

The binary search

Summary

11. Patterns of Algorithm

Recursion

JavaScript limitation on the call stack size

The Fibonacci sequence

Dynamic programming

The minimum coin change problem

The knapsack problem

The longest common subsequence

Matrix chain multiplication

Greedy algorithms

The min-coin change problem

The fractional knapsack problem

Introduction to functional programming

Functional versus imperative programming

ES2015 and functional programming

The JavaScript functional toolbox - map, filter, and reduce

JavaScript functional libraries and data structures

Summary

12. Algorithm Complexity

Big-O notation

Understanding big-O notation

O(1)

O(n)

O(n2)

Comparing complexities

Data Structures

Graphs

Sorting Algorithms

Searching Algorithms

Introduction to the NP-Completeness theory

Impossible problems and heuristic algorithms

Having fun with algorithms

Summary

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部