基本概念

有些人会疑惑,为什么会先讲数据结构,先讲STL

因为算法和数据结构是分不开的,在实现算法或者solving problem的时候,会需要不同姿势的存储数据,或者可以更好的存储数据,从而轻松解决问题。所以,先学STL,先学会用

比如,栈,先学会用stack,以后有时间,再学习一维数组实现栈,再深入学习栈的工作原理。

前期需要理解基本操作,理解什么时候需要用栈这种东西,然后能够面对问题的时候,把栈掏出来,就是当前的学习目标。

A data structure is a way to store data in the memory of a computer. It is important to choose an appropriate data structure for a problem, because each data structure has its own advantages and disadvantages. The crucial question is: which operations are efficient in the chosen data structure?

我们来介绍一下STL(Standard Template Library),C++ 有一个库,里面有很多好东西。是后来出现的,以前不流行,现在很流行的东西。我们学习了很多数据结构,就是那些用来存储数据的东西。在解决问题的时候,我们会选择合适的数据结构来存储这个问题的数据,是因为每个数据结构有优点和缺点。数据结构的相关操作,有一些函数是写好可以直接用的。(记住,你以后还会面临时间复杂度问题,不是所有情况都适合用 STL ,但是前期 STL 非常香)(C++11 在OI赛事中,已经可以使用)

It is a good idea to use the standard library whenever possible, because it will save a lot of time.