数据结构与算法教程(数据结构的知识)

本文目录
数据结构的知识
很多同学对数据结构算法的第一印象,可能是觉得它复杂、深奥、难学。也可能会觉得它不常用,因为在平时的开发过程中,好像不怎么用到数据结构算法。
那我们为什么还要学习数据结构算法呢?
一个很重要的原因,是为了应对面试。数据结构算法,可以说是名企面试必考的。也就是说,国内外一线的大型互联网公司,在面试的过程中,多多少少都会问一些数据结构算法的题目。规模越大的公司,就越注重数据结构算法。甚至,现在中小型公司的面试都开始问算法题了。其实,不管什么行业,为了筛选出更优秀的人才,随着时间的推移,面试的难度肯定都会越来越高的。
今年李明杰MJ小码哥创始人的第一次公开课就是讲述《数据结构与算法》课程大纲:
数据结构算法这块的知识点本来就比较多,有些概念也比较复杂,要想彻底搞清楚,肯定需要花多一点时间。
而且我讲解每个知识点的时候,都会讲得比较细致、比较深入,也会做一些额外的扩展。
另外,我觉得同学们应该要嫌我讲得少啊,应该让我讲得更多一点
同学们也可能看到其他的一些数据结构算法教程,只有10几个小时,甚至是几个小时。时间短,就说明讲得不够详细不够系统。这样的后果是什么呢?你听了1个小时的课程,可能需要花至少5~10个小时的时间去消化吸收,还要自己去慢慢琢磨。如果老师讲解地很细致,你就能理解地更加透彻,那你课后复习巩固所花的时间就少了
数据结构与算法(c++)的视频教程和PDF,急求!!!!
链接:
先推荐两本国内的 /**《请问我应该如何学好数据结构和算法
清华严蔚敏的《数据结构》
电子工业出版社王晓东《计算机算法设计与分析》
这两本书是我入门时候看的,比较经典
国外的这方面的书很多,比较好的有
《数据结构与算法分析——C语言描述(原书第2版)》
作者:(美)MARK ALLEN WEISS
译者:冯舜玺
机械工业出版社
这书我看的是第二版,好像现在已经有第三版了,十分经典
还有
数据结构与算法分析(C++版)(第二版)
作者:(美)CLIFFORD A.SHAFFER
译者:张铭等
电子工业出版社
bbs.kaoyan.com,这里面有,自己去淘咯数据结构算法编程
数据结构实验编程,要求如下:
1) 单链表结点类的定义。
2) 单链表类的定义。
3) 在单链表的第i个结点前插入一个结点。
4) 在单链表的第i个结点前删除一个结点。
5) 在单链表中查找第i个结点。
6) 更新单链表中第i个结点的值。
7)遍历单链表。
希望给出源程序,让我好好研究一下。前提必须要能运行出正确的结果。谢谢!我用的软件是Dev c++,
如果可以运行出正确结果,定采纳!再次感谢!
*/
#include 《iostream》
using namespace std;
class Node {
public:
Node(){
id = 0;
next = NULL;
}
Node(int i){
id = i;
next = NULL;
}
int id;
Node *next;
};
class Chain{
private:
Node *head;
//Node *tail;
int num;
public:
Chain(){
head = NULL;
//tail = NULL;
num = 0;
}
~Chain(){
Node* t = head;
while(t)
{
head = t-》next;
delete t;
t = head;
}
cout 《《 “release“《《endl;
}
void setHead(Node* head){
this-》head = head;
}
Node* getHead(){
return head;
}
void setNum(int num){
this-》num = num;
}
int getNum(){
return num;
}
bool insertIns(Node *ins);
bool insBefore(Node *ins,int i);
bool delBef(int i);
Node *findI(int i);
bool update(int i,int id);
void Chain::travel();
};
bool Chain::insertIns(Node *ins){
if(!ins)
return false;
if(NULL==head){
head = ins;
num++;
return true;
}
Node *cur = head;
while(NULL != cur-》next)
{
cur = cur-》next;
}
cur-》next = ins;
num++;
return true;
}
bool Chain::insBefore(Node *ins,int i)
{
if(i==1){
ins-》next = head;
head = ins;
num++;
return true;
}
if(i》this-》num)
return false;
int pre = i-1;
int cur = 1;
Node *curPt = head;
while(curPt && cur != pre)
{
curPt = curPt-》next;
cur++;
}
if(NULL!=curPt && cur==pre )
{
cout 《《 “ insBefore: curPt.id= “《《curPt-》id 《《endl;
Node *t = curPt-》next;
curPt-》next = ins;
ins-》next = t;
this-》num++;
return true;
}
return false;
}
bool Chain::delBef(int i)
{
if(i《=1 || i 》 num)
return false;
Node *res = findI(i-2);
if(NULL == res)
{
res = findI(i-1);
if(res == head)
{
head = head-》next;
delete res;
num--;
return true;
}
else
return false;// only one
}else{
Node *tmp = res-》next-》next;
Node *tar = res-》next;
delete tar;
res-》next = tmp;
num--;
return true;
}
// if(i《0 || i》 num)
// return false;
// Node *tmp = NULL;
// if(1 == i)
// {
// tmp = head-》next;
// delete head;
// head = tmp;
// num--;
// return true;
// }
// Node *p = findI(i-1);
// if(p){
// tmp = p-》next-》next;
// delete p-》next;
// p-》next = tmp;
// num--;
// }
// else{
// return false;
// }
// return true;
}
Node *Chain::findI(int i)
{
if(i《0 || i》num)
return NULL;
int cur = 1;
Node *p=head;
while(cur!=i){
p = p-》next;
cur++;
}
return p;
}
bool Chain::update(int i,int id)
{
Node *res = findI(i);
bool flag = false;
if(res)
{
res-》id = id;
flag = true;
}
return flag;
}
void Chain::travel(){
Node *cur = head;
while(cur)
{
cout 《《 cur-》id 《《“ “;
cur = cur-》next;
}
cout 《《 endl;
}
int main()
{
Node *npt = NULL;
Chain *cpt = new Chain;
for(int i=0;i《9;i++){
npt = new Node;
if(npt){
npt-》id = i+1;
cpt-》insertIns(npt);
}
}
if(NULL == cpt)
return -1;
cpt-》travel();
cout 《《 “here\n“;
bool res = false;
if(npt)
{
npt = new Node(12);
res = cpt-》insBefore(npt,7);
if(res)
cpt-》travel();
else
cout 《《 “insBefore failed! \n“;
}
cout 《《 “here 2\n“;
//
res = cpt-》delBef(1);
cout 《《 “here 2.2\n“;
if(res)
{
cout 《《 “del 1“ 《《endl;
cpt-》travel();
}
cout 《《 “here 2.5\n“;
res = cpt-》delBef(5);
cout 《《 “here 3\n“;
if(res)
{
puts(“del 5 [[[[“);
cpt-》travel();
puts(“del 5 ]]]]“);
}
///
npt = cpt-》findI(5);
printf(“findI id =%d\n“,npt-》id);
cpt-》travel();
///
cpt-》update(5,99);
cpt-》travel();
cout《《 “------“《《endl;
return 0;
}
//简单测试了一下
更多文章:
majority of(the majority of 和 a majority of的区别以及用法例句)
2026年10月11日 07:40
another time(another time和other time的区别)
2026年10月11日 05:00







