Table of Contents
回复内容:
Home Backend Development PHP Tutorial php程序员要不要学数据结构?

php程序员要不要学数据结构?

Jun 06, 2016 pm 04:43 PM
php

最近参加几个大公司的校招笔试,大部分试题都是数据结构和算法之类的,php怎么用到数据结构呢?恳请过来人给小弟一些指示,多谢多谢

回复内容:

程序员都要学 数据结构是基础,链表、二叉树、哈希、排序算法等,你可能在写PHP代码的时候,不一定能够用上,但是,掌握它们能让你对程序的运作原理有更深的理解。

举个简单的例子:
我们经常使用PHP数组,PHP数组不仅可以foreach的方式遍历,又能通过key-value的方式访问,我们都觉得很便利,那么问题来了,为神马会这样?
原因是PHP5的数组,是个HashTable(哈希表,支持key-value直接映射),并且元素之间又用双向链表连接起来(支持遍历)。如果,同学们不学习数据结构,连链表和hash都不知道,就更谈不上理解内部的运作原理。

这个只是数据结构应用的冰山一角,想对技术有深一些的理解,学好数据结构很有必要。而更好地掌握原理层,又可以促进我们对程序的优化和思考,采用更节省系统资源的方式完成我们的业务需求。 单纯从PHP码代码的角度来说不需要,但是校招你又没有做过什么项目,那不问你数据结构跟算法,问你什么问题呢?至少,数据结构和算法可以检验你在大学中是否认真学习了。 周二刚好面试了一个php程序员,除了一道题,合格答案是O(n^2)交叉遍历两个数组,优良答案是O(N)遍历第一个数组做一个Map,再遍历第二个数组顺便查Map。

然而此人除了调用PHP方法in_array(?)之外,就不知道怎么做一个Map了。现在我们对于要不要招这个人很纠结






才怪。 这也不学,那也不学,那你学什么呢? 个人建议是:先搞定工作,业余时间有针对的学习。 有时间在这刷知乎找答案,还不如去找本数据结构的书看一看呢! 答主曾经年纪小,误入传销组织,里面各种遍历树 自从协程大行其道,数据库结构也不够用了,还要操作系统原理,并行计算都得上阵,这得多累啊,如果钱没多,着实不能干。 不用学,五年后转管理岗
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

See all articles