Do php programmers need to learn the data structure?
Source: Internet
Author: User
Recently, I participated in the school recruitment test of several major companies. Most of the questions are about data structures and algorithms. How does php use data structures? I would like to ask someone to give me some instructions. Thank you for taking the test exams from several major companies recently. Most of the questions are about data structures and algorithms. How does php use data structures? I would like to ask someone to give me some instructions and thank you for your reply: programmers should learn the data structure as the foundation. Linked List, binary tree, hash, sorting algorithm, etc. When you write PHP code, you may not be able to use them. However, mastering them can give you a deeper understanding of the operating principles of the program.
A simple example:
We often use PHP arrays. PHP Arrays can not only be traversed in foreach mode, but can also be accessed in key-value mode. We all think it is very convenient. So the question is, is it true for Shenma?
The reason is that the PHP5 array is a HashTable (hash table, supporting direct key-value ing), and elements are connected by a two-way linked list (supports traversal ). If you do not know the data structure or even the linked list or hash, you cannot understand the internal operating principles.
This is just the tip of the iceberg for Data Structure applicationsTo have a deep understanding of the technology, it is necessary to learn the data structure well. A better understanding of the principle layer can promote our program optimization and thinking, and use a more cost-effective way to meet our business needs. I don't need it from the perspective of PHP code, but I haven't done any projects for school recruitment. I don't ask you any questions about data structures or algorithms? At least, data structures and algorithms can be used to check whether you have carefully studied them in college. On Tuesday, I interviewed a php programmer. In addition to one question, the qualified answer is O (n ^ 2) traversing two arrays. The good answer is O (N) traverse the first array to make a Map, and then traverse the second array to check the Map.
However, in addition to calling the PHP method in_array (?) In addition, I don't know how to make a Map. Now we are struggling to recruit this person or not.
That's strange. If you do not want to learn it, then what do you want to learn? My personal suggestion is: Get the job done first and learn it in your spare time. If you have time to find the answer here, it is better to look for a book on the data structure! A: When I was a young man, I accidentally entered the MLM organization. The traversal trees in the group were widely used since the coroutine, and the database structure was not enough. The operating system principle and parallel computing had to go into battle, it's so tiring. If you don't have much money, you can't do it. Don't study, transfer to management after five years
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.