For example, hashmap, stack, and queue can all be implemented by operating the JS array. Next we will first refer to the official JavaScript User Manual to explain some common functions in the JS array object, in order to implement the following data structure (JS array object is similar to the order of elements in and out of the stack):
Push: add an element
Reverse: sorts array elements in reverse order.
Shift: remove the first element from the array (subscript: 0)
Pop: the last element (subscript: array. Length-1) is displayed)
<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en" "http://www.w3.org/TR/html4/loose.dtd"> <HTML>
Note: Stack and queue implementation can be referred to: http://blog.csdn.net/wdxgdiy/article/details/8877565 write good
Attachment download: http://pan.baidu.com/share/link? Consumer id = 3844618167 & UK = 1763003608