Coder Social home page Coder Social logo

algorithm_frombilibili's Introduction

algorithm_frombilibili's People

Contributors

irving-l avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

algorithm_frombilibili's Issues

树那里前8段代码就错了3、4个 你自己都没运行成功发出来干嘛呢 好看?感动自己?

单向链表的尾插法

void CreatListTail(LinkList &L, const size_t n)
{
Lnode *r = L;
for (int i = 0; i < n; ++i)
{
Lnode *p = new Lnode;
cin >> p->data;
p->next = NULL; #这里是不是应该改成NULL,原来写的是r->next
r->next = p;
r = r->next;
}
}

你的双向链表的头插法有误

你没有考虑链表为空的情况,如果L->next为NULL,则无法执行p->next = L->next。
正确的应该这样

void CreatListHead(LinkList &L, const int n)
{
    for (int i = 0; i < n; ++i)
    {
        DuLnode *p = new DuLnode;
        if (p == NULL)
        {
            cout << "Memory allocation failed." << endl;
            return;
        }
        p->note.name = rand_str(5);
        // cin >> "input name:">>p->note.name;
        p->note.age = rand() % 100;
        // cin >> "input age:">>p->note.age;
        p->prior = L;
        if (L->next == NULL)
        { // the list is empty
            p->next = NULL;
        }
        else
        { // the list is not empty
            p->next = L->next;
            L->next->prior = p;
        }
        L->next = p;
    }
}

DestroyList(L); error

大佬,单向链表的销毁链表是不是有问题啊
int main()
{
int N = 10;
Lnode* L;
cout << "temp" << endl;
InitList(L);
cout << L << endl;
// CreateListHead(L, 3);
CreateListTail(L, 3);
cout << L->next->data << endl;
// cout << L->next + 1<< endl;
// cout << L->next->data<< endl;
cout << IsEmpty(L) << endl;
DestroyList(L);
cout << IsEmpty(L) << endl;

return 0;

}
执行的时候,到 DestroyList(L); 的时候直接core dump退出了

图这一章的结构体的邻接矩阵应该是二维的,不然下面的G.arcs[i][j]怎么赋值?
个人愚见int Arcs[MAXSIZE][MAXSIZE];
在创建无向网时,第一个cin有问题,重复输入值在同一个中。
个人愚见cin>>G.vexnum>>G.arcnum;

大佬,串和广义表的算法代码还有吗

Binary Search Tree

二叉搜索树的插入及生成算法存在问题

void InsertBSTree(BSTree &T, const ElemType &e)

// 原代码
if (T == nullptr)
{
    T = new BSNode;
    T->data = e;
}
// 此处的树左右孩子应置为空指针,更改后的代码
if (!T)
{
    T = new BSTNode;
    T->data = e;
    T->lchild = nullptr;
    T->rchild = nullptr;
}

void CreatBSTree(BSTree &T)

// 原代码
while(cin>>input.key)
{
    vec.push_back(input);
}
// 此处应加入输入终止条件(如回车键终止输入),更改后的代码
while (cin >> input.key)
{
    vec.push_back(input);
    if(cin.get() == '\n') 
    {
        break;
    }
}

在图的creatUDG中存在二义性的问题
p1
这里面的j存在二义性,应该把for中的j改为k防止二义性。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.