- 博客(16)
- 收藏
- 关注
原创 BU4201 Java Lab1
TestArgs.javapublic class TestArgs { public static void main(String[] args){ System.out.println("Name = " + args[0] + " " + args[1]); System.out.println("BUPT email username = " + args[2]); System.out.println("QM
2021-03-29 17:00:38 194
原创 【数据结构】基数排序
#include <stdio.h>#include <stdlib.h>#include <string.h>int GetNumInPos(int num,int pos){ int temp = 1; for (int i = 0; i < pos - 1; i++) temp *= 10; return (num / temp) % 10;}void RadixSort(int* pDataArray
2020-12-17 13:35:25 94
原创 【数据结构】堆排序 Heap Sort
#include <stdio.h>#include <stdlib.h>#include <string.h>void Swap(int* a,int* b){ int temp=*a; *a=*b; *b=temp;}void PercDown(int A[], int i, int N){ int child; int Tmp; for (Tmp = A[i]; 2*i+1 < N; i =
2020-12-17 13:34:52 125
原创 【数据结构】BOJ-Binary search tree 二叉搜索树
#include <stdio.h>#include <string.h>#include <stdlib.h>typedef struct TreeNode { int Data; struct TreeNode* left; struct TreeNode* right;}*BinTree;BinTree CreatByInsert(int X, BinTree BST){ if(BST == NULL) .
2020-12-17 13:24:39 162 1
原创 【数据结构】快速排序结合插入排序
#include <stdio.h>void swap(int *a,int *b){ int t = *a; *a = *b; *b = t;}int Median3(int a[],int l,int r){ int c = (l+r)/2; if(a[l]>a[c]) swap(&a[l],&a[c]); if(a[l]>a[r]) swap(&a[l],&a[r]); if(a[
2020-12-10 14:21:34 237
原创 【数据结构】希尔排序-插入排序
希尔排序&&插入排序#include <stdio.h>void ShellSort(int *a,int num);void InsertSort(int *a,int num);int main() { int num; scanf("%d",&num); int a[num]; for (int i = 0; i < num; ++i) { scanf("%d,",&a[i]); }
2020-12-10 14:20:31 56
原创 【数据结构】BOJ-1.D KMP
#include <stdio.h>#include <string.h>typedef char* SString;int Index_KMP(SString S, SString T, int pos, int Sl, int Tl,int next[]){ int i = pos; int j = 1; while (i <= Sl && j<=Tl ) { if(j == 0 || S[i] == T
2020-12-02 10:40:20 256
原创 【数据结构】BOJ-1.B中缀表达式转后缀表达式并计算
没有题目了 懂得都懂#include <stdio.h>#include <stdlib.h>#include <string.h>typedef char ElemType;typedef struct SNode{ ElemType Element; struct SNode* Next;}*Stack;typedef struct SNodenum{ float Element; struct SNodenum*
2020-12-02 10:38:42 101
原创 【数据机构】BOJ-3.1AVL
可能是抄书或者抄的哪位老同志的代码#include <stdio.h>#include <stdlib.h>#include <string.h>#define LH +1 //左高#define EH 0 //等高#define RH -1 //右高#define TRUE 1#define FALSE 0typedef int Status;typedef struct BiTNode{ int data; int bf.
2020-11-28 21:09:27 265
原创 【数据结构】BOJ-1.A括号匹配
#include <stdio.h>#include <stdlib.h>typedef char ElemType;struct SNode{ ElemType Element; struct SNode* Next;};typedef struct SNode *Stack;Stack CreateStack(){ Stack S; S=(Stack)malloc(sizeof(struct SNode)); S.
2020-11-28 21:03:42 151
原创 【数据结构】BOJ-6.1最短路径(*dij算法更新了)
输入:1,4输出:1,2,4,7,6,代码拙劣 勿喷又臭又长网上抄来的dijikstra算法:#include <stdio.h>#define N 99999#define MAX 8void dijikstra(int G[MAX][MAX], int n, int startnode){ int cost[MAX][MAX], distance[MAX], pred[MAX]; int visited[MAX], count, mindistance, .
2020-11-28 20:38:11 154 3
原创 【数据结构】BOJ-5.1拓扑排序
【数据结构】BOJ-V4拓扑排序输入A,B输出:S,B,G,D,H,A,E,I,F,C,T,要用队列代码拙劣比较靠谱版:#include <stdio.h>#define N 11typedef struct queue{ int data[100]; int head, rear;}Queue;void Enqu(Queue *Q,int value){ Q->data[Q->rear++]=value;}void De
2020-11-28 20:24:24 200 3
原创 【数据结构】BOJ-4.1十字链表的部分实现(朋友圈点赞问题)
【数据结构】782.朋友圈点赞(c语言 十字链表的部分实现)#include <stdio.h>#include <string.h>#include <stdlib.h>typedef struct ArcBox{ int headVex,tailVex; struct ArcBox *hLink; struct ArcBox *tLink;}ArcBox;//弧结点typedef struct VexNode{ int
2020-11-08 19:41:40 598 1
原创 【数据结构】十字链表完全实现(C语言)
【数据结构】十字链表完全实现(C语言)#include <stdio.h>#include <stdlib.h>#include <string.h>#define MaxNum 20typedef int Status;typedef int InfoType;typedef char VertexType;//弧结点结构体typedef struct ArcBox{ int tailVex,headVex; struct Arc
2020-11-04 12:41:50 530 1
原创 【数据结构】BOJ-3.2哈夫曼树的编码与译码(C语言)
【数据结构】哈夫曼树的编码与译码(C语言)哈夫曼#include <stdio.h>#include <stdlib.h>#include <string.h>#define LEN 8typedef struct HaffTNode{ int weight; struct HaffTNode *parent,*right,*left;}HaffTNode,*HaffTree;HaffTree CreatHaffTNode(int
2020-11-03 20:05:35 1238 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人