"Data structure and algorithm JavaScript description"
Basic information
Beauty Michael McMillan
Translator: Wang Qunfeng Du Huan
Series Name: Turing programming series
Publisher: People's post and telecommunications publishing house
isbn:9787115363398
Last Date: 2014-8-5
Publication date: August 2014
Folio: 16 Open
Edition: 1-1
Category: Computer > Software and Programming > Network programming > JavaScript
More about the "data structure and algorithm JavaScript description"
Editorial recommendations
As JavaScript succeeds in getting out of the client and is increasingly being used in server-side programming, JavaScript programmers need to implement data structures and algorithms similar to traditional object-oriented programming languages such as C # or Java. This book is to use JavaScript to describe the data structure and algorithm of the mountain, bringing together the author for many years of practical experience. This hands-on guide is a rich example of how you can efficiently achieve programming with a range of storage mechanisms, including lists, stacks, queues, and graphs, in a JavaScript environment.
Content Introduction
Books
Computer Books
Over the past few years, JavaScript has been widely used in server-side programming with platforms such as node. js and SpiderMonkey. JavaScript programmers therefore urgently need to use the tools provided by traditional languages such as C + + and Java, including traditional data structures and traditional sorting and finding algorithms. The data structure and algorithm JavaScript description discusses how to implement efficient data structures and algorithms in the context of JavaScript languages such as arrays, ubiquitous global variables, and prototype-based object models.
The data structure and algorithm JavaScript description is suitable for JavaScript programmers and learners interested in JavaScript language, especially "cross-border" programmers who are not systematically learning computer science-related courses in school.
Media Review
"This book is very good for front-end engineers to get started with data structures and algorithms, and it's very difficult for front-end engineers to learn the basics." ”
--Cheng, senior technical expert of Ali Wireless Division
Directory
"Data structure and algorithm JavaScript description"
Recommended Order XI
Foreword XII
1th. JavaScript programming environment and model 1
1.1 JavaScript Environment 1
1.2 JavaScript Programming Practice 2
1.2.1 Declaration and initialization of variables 3
1.2.2 Arithmetic operations and math library functions in JavaScript 3
1.2.3 Judgment Structure 4
1.2.4 Cycle Structure 6
1.2.5 Function 7
1.2.6 Variable Scope 7
1.2.7 Recursion 9
1.3 Object and object-oriented programming 10
1.4 Summary 11
The 2nd Chapter Array 13
2.1 Definition of arrays in JavaScript 13
2.2 Using Arrays 13
2.2.1 Creating an array 14
2.2.2 Read-write array 15
2.2.3 array Generation by string 15
2.2.4 integral operation of an array 16
2.3 Access Function 17
2.3.1 Finding elements 17
String representation of the 2.3.2 array 18
2.3.3 creating a new array from an existing array 18
2.4 Variable function 19
2.4.1 adding elements to an array 19
2.4.2 Removing an element from an array 20
2.4.3 Adding and removing elements from an array's middle position 21
2.4.4 Array Sort 21
2.5 Iterator Method 22
2.5.1 iterator method that does not generate a new array 22
2.5.2 iterator method for generating a new array 25
2.6 and multidimensional Arrays 27
2.6.1 creating a two-dimensional array 27
2.6.2 handling elements of a two-dimensional array 28
2.6.3 Jagged Array 29
2.7 Object Array 30
2.8 Array of objects in 31
2.9 Exercise 32
The 3rd Chapter list 33
3.1 Abstract data type definition for a list 33
3.2 Implementing the List class 34
3.2.1 Append: Adding elements to the list 35
3.2.2 Remove: Removing elements from the list 35
3.2.3 Find: Finding an element in a list 35
3.2.4 Length: How many elements are in a list 36
3.2.5 ToString: Displaying elements in a list 36
3.2.6 insert: Inserting an element into a list 37
3.2.7 clear: Empties all elements in the list 37
3.2.8 contains: Determine if the given value is in the list 37
3.2.9 traversing the list 38
3.3 Using iterators to access the list 39
3.4 A list-based application 40
3.4.1 reading a text file 40
3.4.2 using the list to manage DVD Rentals 41
3.5 Exercise 44
The 4th Chapter Stack 45
4.1 Operation of the Stack 45
4.2 Implementation of the stack 46
4.3 Using the Stack class 48
4.3.1 conversion between the numbering of 49
4.3.2 Palindrome 50
4.3.3 Recursive demo 51
4.4 Exercise 52
5th. Queue 53
5.1 Operations on a queue 53
5.2 A queue implemented with arrays 54
5.3 Using the queue: Square dance partner Assignment Question 57
5.4 Sorting data using a queue 61
5.5 Priority Queue 63
5.6 Exercise 65
The 6th Chapter List 67
6.1 Disadvantages of Array 67
6.2 Defining the list 67
6.3 Designing an Object-based linked list 69
6.3.1 Node Class 69
6.3.2 LinkedList Class 69
6.3.3 inserting a new node 69
6.3.4 Removing a node from a linked list 71
6.4 Doubly linked list 74
6.5 Circular Link List 78
6.6 Other ways to list 79
6.7 Exercise 79
7th Chapter Dictionary 81
7.1 Dictionary Class 81
Auxiliary Methods for 7.2 Dictionary class 83
7.3 Adding sort functions to the dictionary class 85
7.4 Exercise 86
8th Chapter Hash 87
8.1 Hashing Overview 87
8.2 Hashtable class 88
8.2.1 Select a hash function 88
8.2.2 a better hash function 91
8.2.3 Hash Integer key 93
8.2.4 sorting the hash list, taking a value from the hash table 95
8.3 Collision Handling 96
8.3.1 Open Chain Method 96
8.3.2 Linear detection Method 99
8.4 Exercise 100
Chapter 9th Collection 101
9.1 Definition, operation, and properties of the set 101
9.1.1 definition of a collection 101
9.1.2 Operations on a collection 102
Implementation of the 9.2 set class 102
9.3 More set Operations 104
9.4 Exercise 107
10th Chapter Two fork Tree and two fork find tree 109
10.1 Definition of a tree 109
10.2 Two fork Tree and two fork find tree 111
10.2.1 implementation two fork find tree 111
10.2.2 Traverse Binary Lookup Tree 113
10.3 Find on binary lookup tree 116
10.3.1 find minimum and maximum values 116
10.3.2 finding the given value 117
10.4 Removing nodes from the two-fork lookup tree 118
10.5 Count 120
10.6 Exercise 123
The 11th chapter diagram and graph algorithm 125
11.1 Definition of Figure 125
11.2 Modeling real-world systems with graphs 127
11.3 Figure Class 127
11.3.1 represents vertex 127
11.3.2 means side 127
11.3.3 Building Figure 128
11.4 Search Figure 130
11.4.1 Depth First search 130
11.4.2 Breadth First Search 133
11.5 Finding the shortest path 135
11.5.1 breadth-First search corresponding shortest path 135
11.5.2 Determining the Path 135
11.6 topology sequencing 137
11.6.1 topology sorting algorithm 137
11.6.2 implementing a topological sorting algorithm 137
11.7 Exercise 141
12th Chapter Sorting Algorithm 143
12.1 Array Test Platform 143
12.2 Basic Sorting algorithm 145
12.2.1 Bubble Sort 145
12.2.2 Select Sort 148
12.2.3 Insert Sort 150
Timing comparison of 12.2.4 basic sorting algorithm 151
12.3 Advanced Sorting Algorithm 153
12.3.1 Hill Sort 153
12.3.2 Merge Sort 158
12.3.3 Quick Sort 163
12.4 Exercise 167
The 13th Chapter search algorithm 169
13.1 Order Lookup 169
13.1.1 find minimum and maximum values 172
13.1.2 using self-organizing data 175
13.2 Binary Lookup Algorithm 177
13.3 Finding text data 183
13.4 Exercise 185
14th Advanced Algorithm 187
14.1 Dynamic Planning 187
14.1.1 Dynamic Programming Example: calculating Fibonacci sequence 188
14.1.2 looking for the longest common substring 191
14.1.3 knapsack problem: Recursive solution 194
14.1.4 knapsack problem: Dynamic planning Scenario 195
14.2 Greedy algorithm 196
14.2.1 First greedy algorithm case: Change question 196
14.2.2 knapsack problem greedy algorithm solution 197
14.3 Exercise 199
Cover Introduction 200
The source of book Information: Interactive Publishing Network