Skip to content

Commit 000000c

Browse files
committed
13_30
1 parent 830faa9 commit 000000c

File tree

8 files changed

+66
-376
lines changed

8 files changed

+66
-376
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ project(datastruct_cpp)
33

44
set(CMAKE_CXX_STANDARD 14)
55

6-
add_executable(datastruct_cpp main.cpp SeqStack.h DblStack.h LinkStack.h CireQueue.h MGraph.h ListSet.h List.h CircList.h dbList.h Polynomial.h LinkQueue.h SeqDeueue.h PQueue.h SeqString.h HString.h Glist.h)
6+
add_executable(datastruct_cpp main.cpp SeqStack.h DblStack.h LinkStack.h CireQueue.h MGraph.h ListSet.h List.h CircList.h dbList.h Polynomial.h LinkQueue.h SeqDeueue.h PQueue.h SeqString.h HString.h Glist.h GenList.h)

GenList.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// Created by kenochou on 22-10-13.
3+
//
4+
#include<stdio.h>
5+
#include <stdlib.h>
6+
#include<string.h>
7+
#ifndef DATASTRUCT_CPP_GENLIST_H
8+
#define DATASTRUCT_CPP_GENLIST_H
9+
typedef char ELemType;
10+
typedef struct node{
11+
int tag;
12+
struct node * tlink;
13+
union {
14+
char ref;
15+
ELemType value;
16+
struct node * hlink;
17+
18+
}info;
19+
}GenListNode,*GenList;
20+
21+
#endif //DATASTRUCT_CPP_GENLIST_H

Glist.h

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,46 @@
11
//
22
// Created by kenochou on 22-10-13.
33
//
4-
4+
#include<stdio.h>
5+
#include<stdlib.h>
56
#ifndef DATASTRUCT_CPP_GLIST_H
67
#define DATASTRUCT_CPP_GLIST_H
8+
typedef char ElemType;
9+
typedef struct node{
10+
int tag;
11+
int mark;
12+
struct node * tlink;
13+
union {
14+
ElemType data;
15+
struct node * hlink;
16+
}val;
717

18+
}GLNode,*Glist;
19+
void CreateGlist(char * S,int & i,GLNode * & g) {
20+
char ch = S[i++];
21+
if (ch != '\0') {
22+
if (ch == '(') {
23+
if (S[i] == ')') {g = NULL;i++;}
24+
else {
25+
g = (GLNode *) malloc(sizeof(GLNode));
26+
g->tag = 1;
27+
g->mark = 0;
28+
CreateGlist(S, i, g->val.hlink);
29+
}
30+
}
31+
else if (ch == ')')g = NULL;
32+
else if (ch == ',') {
33+
g = (GLNode *) malloc(sizeof(GLNode));
34+
g->tag = 1;
35+
g->mark = 0;
36+
CreateGlist(S, i, g->val.hlink);
37+
CreateGlist(S, i, g->tlink);
38+
} else {
39+
g = (GLNode *) malloc(sizeof(GLNode));
40+
g->tag = 0;
41+
g->mark = 0;
42+
g->val.data = ch;
43+
}
44+
}
45+
}
846
#endif //DATASTRUCT_CPP_GLIST_H

cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-70e30138e3e9c098b988.json

Lines changed: 0 additions & 60 deletions
This file was deleted.

cmake-build-debug/.cmake/api/v1/reply/index-2022-10-13T04-57-04-0626.json

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)