diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b3ef694 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ + +*.class +*.o +*.o +*.exe diff --git a/cPractice/datastructure/datastructure.cbp b/cPractice/datastructure/datastructure.cbp index 201fe13..8425e63 100644 --- a/cPractice/datastructure/datastructure.cbp +++ b/cPractice/datastructure/datastructure.cbp @@ -44,6 +44,9 @@ + + diff --git a/cPractice/datastructure/datastructure.depend b/cPractice/datastructure/datastructure.depend index b28925b..6345634 100644 --- a/cPractice/datastructure/datastructure.depend +++ b/cPractice/datastructure/datastructure.depend @@ -23,3 +23,21 @@ 1562835019 f:\code\mycode\c\datastructer\datastructure\include\common_define.h +1562294963 source:f:\code\mycode\algorithmpractice\cpractice\datastructure\src\removedup.c + "removeDup.h" + +1562294789 f:\code\mycode\algorithmpractice\cpractice\datastructure\include\removedup.h + +1564483905 source:f:\code\mycode\algorithmpractice\cpractice\datastructure\main.c + + + "removeDup.h" + "common_define.h" + +1565025551 f:\code\mycode\algorithmpractice\cpractice\datastructure\include\common_define.h + +1564483877 source:f:\code\mycode\algorithmpractice\cpractice\datastructure\src\sequence_table.c + + + + diff --git a/cPractice/datastructure/datastructure.layout b/cPractice/datastructure/datastructure.layout index 9bc76c2..c86bec1 100644 --- a/cPractice/datastructure/datastructure.layout +++ b/cPractice/datastructure/datastructure.layout @@ -2,29 +2,34 @@ - + - + - + - + - + - + - + - + - + + + + + + diff --git a/cPractice/datastructure/include/common_define.h b/cPractice/datastructure/include/common_define.h index 9be7863..3ecbdad 100644 --- a/cPractice/datastructure/include/common_define.h +++ b/cPractice/datastructure/include/common_define.h @@ -1,5 +1,8 @@ #ifndef COMMON_DEFINE_H_INCLUDED #define COMMON_DEFINE_H_INCLUDED +#define MAXSIZE 1000 +typedef int ElemType; + typedef struct{ char name[20]; @@ -12,4 +15,18 @@ typedef struct{ int length; }SqList; + +/* ��̬������� */ +typedef struct{ + ElemType data; + int next; +}SNode; + +typedef struct{ + SNode sd[MAXSIZE]; + int SL,AV; /* ����ͷָ��*/ + int SLinksize; + +}StaticLink; + #endif // COMMON_DEFINE_H_INCLUDED diff --git a/cPractice/datastructure/main.c b/cPractice/datastructure/main.c index 1f4a55a..18b95dd 100644 --- a/cPractice/datastructure/main.c +++ b/cPractice/datastructure/main.c @@ -14,10 +14,34 @@ int main() // ===== ɾ�����������ж������Ԫ��====================== // testRemoveDup(); + // ��ʼ��˳��� SqList L; if(initSqlList(&L,10)) - printf("success"); + printf("success \n"); + printf(" %d ", L.length+1); + STD std; + strcpy(std.name,"test"); + std.score= 90; + + + int re = insertSqlList(&L,L.length+1,std); + if(re){ + printf("insert success \n"); + } + + STD std2; + strcpy(std.name,"����"); + std2.score= 99; + insertSqlList(&L,L.length+1,std2); + + std2.score= 98; + + + printfSqlList(L); + + updateSqlList(&L,2,std2); + printfSqlList(L); return 0; diff --git a/cPractice/datastructure/src/sequence_table.c b/cPractice/datastructure/src/sequence_table.c index 09db1a7..ea756b8 100644 --- a/cPractice/datastructure/src/sequence_table.c +++ b/cPractice/datastructure/src/sequence_table.c @@ -4,7 +4,7 @@ int initSqlList(SqList *L, int max){ - L->data =(STD*) malloc(sizeof(STD)*max ); + L->data =(STD *) malloc(max* sizeof(STD) ); if(L->data == NULL){ printf("init failed...\n"); return 0; @@ -13,3 +13,48 @@ int initSqlList(SqList *L, int max){ L->length = 0; return 1; } + +//������λ�� �����룬ע�������1��ʼ��ʵ�ʴ洢��0�� +int insertSqlList(SqList *L,int i,STD std){ + + if(i<1|| i> L->length+1){ + printf("pos error..."); + }; + if(L->length > L->listsize){ + printf("��������"); + }; + int j; + for(j=L->length ; j>=i; j--){ + L->data[j] = L->data[j-1]; + } + L->data[i-1]= std; + L->length=L->length + 1; + return 1; +} + +//ɾ���� ǰ�� +int deleteSqlList(SqList *L, int i, STD *std){ + + *std = L->data[i-1]; + int k; + for(k=i-1; k< L->length;k++){ + L->data[k-1] = L->data[k]; + } + L->length = L->length -1; + return 1; +} + +int updateSqlList(SqList *L, int i, STD std){ + L->data[i-1] = std; + return 1; +} + +void printfSqlList(SqList L){ + int i; + for(i=0;i +#include +#include + +int initSLink(StaticLink *L) +{ + L->SL=0; + +} diff --git a/javaPractice/.idea/workspace.xml b/javaPractice/.idea/workspace.xml index 809ca44..26dca5f 100644 --- a/javaPractice/.idea/workspace.xml +++ b/javaPractice/.idea/workspace.xml @@ -2,10 +2,15 @@ - - - - + + + + + + + + + @@ -60,11 +65,21 @@ - + - - + + + + + + + + + + + + @@ -122,16 +137,6 @@ - - - - - - - - - - @@ -165,6 +170,7 @@ @@ -204,9 +210,9 @@ - + @@ -225,20 +231,6 @@ - - - - - - - -