数据结构与算法
文章平均质量分 65
Cb_MX
这个作者很懒,什么都没留下…
展开
-
单链表的C实现
#include#include//定义链表节点结构typedef struct Node { int data; struct Node *pNext; }NODE,*PNODE;//初始化链表PNODE create_list(void){ int len; int i; int val;//用来存放临时的值原创 2013-08-20 21:43:26 · 499 阅读 · 0 评论 -
循环队列的链式存储实现
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication2{ //循环队列的链式存储 public class LinkQueue { NodeQueue front; NodeQueue rea原创 2015-11-17 17:26:03 · 1035 阅读 · 0 评论 -
四则运算计速器算法
public class Test { public static void main(String[] args) { String exp = "-3*9-2-1"; MyStack numStack = new MyStack(); MyStack opeStack = new MyStack(); int index = 0; String keepNum = ""; whi原创 2015-11-17 17:20:32 · 363 阅读 · 0 评论 -
循环单链表的实现,解决约瑟夫丢手帕问题
<!DOCTYPE unspecified PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>php--循环单链表的实现,解决约瑟夫丢手帕问题</title></head><body><?phpclass Child{ public $no;原创 2015-11-17 17:21:52 · 439 阅读 · 0 评论 -
数组共享双栈的实现
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication2{ //数组共享双栈 public class ShareDoubleStack{ public int top1{get;set;}//第一个栈,原创 2015-11-17 17:23:06 · 655 阅读 · 0 评论 -
循环队列的顺序存储
课程回顾:过滤器过滤器的概述1.过滤器的作用:过滤!! 2.过滤器的特点 * 过滤器是双向的。 * 去的时候执行放行之前的代码,回来的时候执行放行之后的代码。 * 包含多个过滤器,过滤器链 过滤器的开发入门1.编写代码 * 类实现Filter接口,重写三个方法 * init(FilterConfig config) *原创 2015-11-17 17:24:46 · 539 阅读 · 0 评论 -
几种常见的排序C实现
#include#include//冒泡排序从小到大 第一趟得到最大的存到数组的最后,第二趟得到数组的第二大的,存到数组的倒数第二位。依次。。void bubble_sort(int *p){ int length=6 ; for(int i=0;i for(int j=0;j if(p[j]>p[j+1]){ int t; t=p[j];原创 2013-08-22 22:04:11 · 515 阅读 · 0 评论 -
哈弗曼二叉树的C简单实现
#include#include#define m 100struct ptree //定义二叉树结点类型 { int w; //定义结点权值 struct ptree *lchild; //定义左子结点指针 struct ptree *rchild;原创 2013-08-30 08:42:44 · 661 阅读 · 0 评论 -
二叉树的非递归遍历C实现
#include#include#define maxsize 100#define StackSize 30 /*假定预分配的栈空间最多为30*/ typedef struct TNode{ char data; struct TNode *lchild,*rchild;}TNode,*Tree;typedef struct{ Tree data原创 2013-08-24 16:13:23 · 509 阅读 · 0 评论 -
队列的顺序存储C实现
#include#includetypedef struct Queue{int * pBase;//数组 存放节点的值int front; //指向队头的数字int rear; //指向队尾的数字int length;//队列的长度}QUEUE;//初始化队列void init(QUEUE *pQueue,int n){pQueue->pBase=(int *)malloc(sizeof(int原创 2013-08-22 15:36:00 · 567 阅读 · 0 评论 -
二叉树的简单C实现
#include#includetypedef struct TNode{ char data; struct TNode *lchild,*rchild;}TNode,*Tree;//初始化二叉树Tree create_tree(void){ TNode* T; char ch; scanf("%c",&ch); if(ch=='#')原创 2013-08-23 17:21:16 · 607 阅读 · 0 评论 -
栈的C实现
#include#include//定义栈节点结构typedef struct Node { int data; struct Node *pNext; }NODE,*PNODE;//定义栈结构typedef struct Stack{ PNODE pTop; PNODE pBottom;}STACK,*PSTACK;vo原创 2013-08-21 21:51:08 · 555 阅读 · 0 评论 -
KMP算法实现
class Program { static void GetNextVal(string str, int [] next) { int i = 0; int j = -1; next[0] = -1; while (i < str.Length - 1) {原创 2015-11-17 17:27:00 · 494 阅读 · 0 评论