Simulation Data Structures

Source: Internet
Author: User

Simulation Data Structures

Array

Stack???????? You can only insert data at the same end, delete data on the same side, and then exit.

Queue???? Only allow data to be inserted at one end, delete data on the other, FIFO

CPU (Center processor Unit)

Array_pop ();???? Deletes an element from the end of the array, returning the element that was deleted

Example:

Array_push ();???? Appends an element to the end of an array, returning the array length after adding a new element

Example:

Array_shift ();???? Deletes an element from the head of the array and returns the deleted element

Example:

Array_unshift ();???? Adds an element to the head of the array and returns the array length after adding a new element

Example:

Simulation stack: Because the operation rules of the stack is to add and delete data at the same end, using Array_pop, Array_push and Array_shift, array_unshfit simulation stack operation

Queue operations: Because the rules of the queue are added at one end to delete at the other end, you can use Array_unshift, Array_pop and Array_push, array_shift to simulate queue operations.

Array_keys ();???? Gets the key names of all the elements in the array and returns them as an indexed array.

Array_values (); Gets the key values of all the elements in the array and returns them as an indexed array. it is convenient to convert an associative array into an indexed array

Example:

Array_key_exists ();???????? Used to determine if a key name exists, there is a return of true, there is no return false

In_array ();???????????????? Used to determine if a key value exists.

Example:

Implode ();???????????? Used to stitch an array element into a string by a specified delimiter.

Example:

Count ();???????? Used to get the length of an array

Range (m,n);???????? Used to return the characters between M and n by the Unicode encoding m and N, and to organize the array returns

Example:

Simulation Data Structures

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.