万本电子书0元读

万本电子书0元读

顶部广告

Hands-On Data Structures and Algorithms with JavaScript电子书

售       价:¥

2人正在读 | 0人评论 9.8

作       者:Kashyap Mukkamala

出  版  社:Packt Publishing

出版时间:2018-01-30

字       数:32.6万

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

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

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Increase your productivity by implementing complex data structures and algorithms using JavaScript About This Book ? A step by step guide, which will provide you with a thorough discussion on the analysis and design of fundamental JavaScript data structures ? Get a better understanding of advanced concepts such as space and time complexity to optimize your code ? Focus more on solving the business problem and less on the technical challenges involved Who This Book Is For If you are a JavaScript developer looking for practical examples to implement data structures and algorithms in your web applications, then this book is for you. Familiarity with data structures and algorithms will be helpful to get the most out of this book. What You Will Learn ? Build custom Back buttons embedded within your application ? Build part of a basic JavaScript syntax parser and evaluator for an online IDE ? Build a custom activity user tracker for your application ? Generate accurate recommendations for credit card approval using Decision Trees ? Simplify complex problems using a graphs ? Increase the performance of an application using micro-optimizations In Detail Data structures and algorithms are the fundamental building blocks of computer programming. They are critical to any problem, provide a complete solution, and act like reusable code. Using appropriate data structures and having a good understanding of algorithm analysis are key in JavaScript to solving crises and ensuring your application is less prone to errors. Do you want to build applications that are high-performing and fast? Are you looking for complete solutions to implement complex data structures and algorithms in a practical way? If either of these questions rings a bell, then this book is for you! You'll start by building stacks and understanding performance and memory implications. You will learn how to pick the right type of queue for the application. You will then use sets, maps, trees, and graphs to simplify complex applications. You will learn to implement different types of sorting algorithm before gradually calculating and analyzing space and time complexity. Finally, you'll increase the performance of your application using micro optimizations and memory management. By the end of the book you will have gained the skills and expertise necessary to create and employ various data structures in a way that is demanded by your project or use case. Style and approach Step-by-step topics will help you get started with solutions for implementing classic data structures and algorithms. Learn by doing with hands-on code snippets that give you practical experience of the subject.
目录展开

Title Page

Copyright and Credits

Hands-On Data Structures and Algorithms with JavaScript

PacktPub.com

Why subscribe?

PacktPub.com

Contributors

About the author

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Conventions used

Get in touch

Reviews

Building Stacks for Application State Management

Prerequisites

Terminology

API

Don't we have arrays for this?

Creating a stack

Implementing stack methods

Testing the stack

Using the stack

Use cases

Creating an Angular application

Installing Angular CLI

Creating an app using the CLI

Creating a stack

Creating a custom back button for a web application

Setting up the application and its routing

Detecting application state changes

Laying out the UI

Navigating between states

Final application logic

Building part of a basic JavaScript syntax parser and evaluator

Building a basic web worker

Laying out the UI

Basic web worker communication

Enabling web worker communications

Transforming input to machine-understandable expression

Converting infix to postfix expressions

Evaluating postfix expressions

Summary

Creating Queues for In-Order Executions

Types of queue

Implementing APIs

Creating a queue

A simple queue

Testing the queue

Priority Queue

Testing a priority queue

Use cases for queues

Creating a Node.js application

Starting the Node.js server

Creating a chat endpoint

Implementing logging using priority queues

Comparing performance

Running benchmark tests

Summary

Using Sets and Maps for Faster Applications

Exploring the origin of sets and maps

Analyzing set and map types

How weak is WeakMap?

Memory management

API differences

Sets versus WeakSets

Understanding WeakSets

The API difference

Use cases

Creating an Angular application

Creating custom keyboard shortcuts for your application

Creating an Angular application

Creating states with keymap

Activity tracking and analytics for web applications

Creating the Angular application

Performance comparison

Sets and Arrays

Maps and Objects

Summary

Using Trees for Faster Lookup and Modifications

Creating an Angular application

Creating a typeahead lookup

Creating a trie tree

Implementing the add() method

The friends' example

Implementing the search() method

Retaining remainders at nodes

The final form

Creating a credit card approval predictor

ID3 algorithm

Calculating target entropy

Calculating branch entropy

The final information gain per branch

Coding the ID3 algorithm

Generating training dataset

Generating the decision tree

Predicting outcome of sample inputs

Visualization of the tree and output

Summary

Simplify Complex Applications Using Graphs

Types of graphs

Use cases

Creating a Node.js web server

Creating a reference generator for a job portal

Creating a bidirectional graph

Generating a pseudocode for the shortest path generation

Implementing the shortest path generation

Creating a web server

Running the reference generator

Creating a friend recommendation system for social media

Understanding PageRank algorithm

Understanding Personalized PageRank (PPR) Algorithm

Pseudocode for personalized PageRank

Creating a web server

Implementing Personalized PageRank

Results and analysis

Summary

Exploring Types of Algorithms

Creating a Node.js application

Use cases

Using recursion to serialize data

Pseudocode

Serializing data

Using Dijkstra to determine the shortest path

Pseudo code

Implementing Dijkstra's algorithm

Using BFS to determine relationships

Pseudo code

Implementing BFS

Using dynamic programming to build a financial planner

Pseudo code

Implementing the dynamic programming algorithm

Using a greedy algorithm to build a travel itinerary

Understanding spanning trees

Pseudo code

Implementing a minimum spanning tree using a greedy algorithm

Using branch and bound algorithm to create a custom shopping list

Understanding branch and bound algorithm

Implementing branch and bound algorithm

When not to use brute-force algorithm

Brute-force Fibonacci generator

Recursive Fibonacci generator

Memoized Fibonacci generator

Summary

Sorting and Its Applications

Types of sorting algorithms

Use cases of different sorting algorithms

Creating an Express server

Mocking library books data

Insertionsort API

What is Insertionsort

Pseudo code

Implementing Insertionsort API

Mergesort API

What is Mergesort

Pseudo code

Implementing Mergesort API

Quicksort API

What is Quicksort

Pseudo code

Implementing the Quicksort API

Lomuto Partition Scheme

Hoare Partition Scheme

Performance comparison

Summary

Big O Notation, Space, and Time Complexity

Terminology

Asymptotic Notations

Big-O notation

Omega notation

Theta Notation

Recap

Examples of time complexity

Constant time

Logarithmic time

Linear time

Quadratic time

Polynomial time

Polynomial time complexity classes

Recursion and additive complexity

Space complexity and Auxiliary space

Examples of Space complexity

Constant space

Linear space

Summary

Micro-Optimizations and Memory Management

Best practices

Best practices for HTML

Declaring the correct DOCTYPE

Adding the correct meta-information to the page

Dropping unnecessary attributes

Making your app mobile ready

Loading style sheets in the <head>

Avoiding inline styles

Using semantic markup

Using Accessible Rich Internet Applications (ARIA) attributes

Loading scripts at the end

CSS best practices

Avoiding inline styles

Do not use !important

Arranging styles within a class alphabetically

Defining the media queries in an ascending order

Best practices for JavaScript

Avoiding polluting the global scope

Using 'use strict'

Strict checking (== vs ===)

Using ternary operators and Boolean || or &&

Modularization of code

Avoiding pyramid of doom

Keeping DOM access to a minimum

Validating all data

Do not reinvent the wheel

HTML optimizations

DOM structuring

Prefetching and preloading resources

<link rel=prefetch >

<link rel=preload >

Layout and layering of HTML

The HTML layout

HTML layers

CSS optimizations

Coding practices

Using smaller values for common ENUM

Using shorthand properties

Avoiding complex CSS selectors

Understanding the browser

Avoiding repaint and reflow

Critical rendering path (CRP)

JavaScript optimizations

Truthy/falsy comparisons

Looping optimizations

The conditional function call

Image and font optimizations

Garbage collection in JavaScript

Mark and sweep algorithm

Garbage collection and V8

Avoiding memory leaks

Assigning variables to global scope

Removing DOM elements and references

Closures edge case

Summary

What's next?

Other Books You May Enjoy

Leave a review - let other readers know what you think

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

发表评论

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

买过这本书的人还买过

读了这本书的人还在读

回顶部