编程/算法整理

合并两个链表

typedef struct Node{

   int data;
    struct Node *next;
}Node,*LinkList;

void CreatList(LinkList &L, int n){
    LinkList p,r;
    r = L;
    int a;
    for(int i = 0; i < n; i++){
        p = (LinkList)malloc(sizeof(Node));
        scanf("%d",&a);
        p->data = a;
        r->next = p;
        r = p;
    }
    r->next = NULL;
}

map

map是STL的一个关联容器,它提供一对一的hash。

第一个可以称为关键字(key),每个关键字只能在map中出现一次;
第二个可能称为该关键字的值(value);

#include <map>  //注意,STL头文件没有扩展名.h

map<int, string> mapStudent;

mapStudent.insert(pair<int, string>(000, "student_zero"));

原文地址:https://www.cnblogs.com/Annetree/p/13511636.html