
数据结构
数据结构
Wanidde
本人很懒,什么都没有留下 ^_^
展开
-
链表实现队列
#include<stdio.h> #include<stdlib.h> struct node { int data; node *next; }; struct queue { node *head; node *tail; }q; void in() { int n,a,i; scanf("%d",&n); printf("请输入要入队的数:...原创 2019-06-06 11:55:33 · 124 阅读 · 0 评论 -
链表实现栈
#include<stdio.h> #include<stdlib.h> struct node { int data; struct node *next; }; struct stack { node *top; }q; void push(int n) { node *p; int a,i; printf("请输入要入栈的数据:\n"); for(i=...原创 2019-06-06 11:58:03 · 174 阅读 · 0 评论 -
栈
栈是后进先出的数据结构。它限定为只能在一端进行插入和删除操作。 题目: 判断一个串是否是回文串。 先找到中间的字符,把他之前的字符入栈,再从他的后面一个字符开始和栈中最先出栈的字符比较。 代码: #include<stdio.h> #include<string.h> int main() { char a[101]; char s[101...原创 2019-06-03 16:01:13 · 136 阅读 · 0 评论 -
链表
链表是什么: 链表是一种由上一个元素的引用指向下一个元素的存储结构,链表通过指针来连接元素与元素。 链表与数组的区别: (1) 链表是链式的存储结构; (2) 数组是顺序的存储结构; (3)链表通过指针来连接元素与元素,数组则是把所有元素按次序依次存储。 基本实现: #include<stdio.h> #include<stdlib.h&g...原创 2019-06-03 16:14:24 · 135 阅读 · 0 评论 -
UVA 673 - Parentheses Balance (栈)
You are given a string consisting of parentheses () and []. A string of this type is said to be correct: (a) if it is the empty string (b) if A and B are correct, AB is correct, (c) if A ...原创 2019-01-19 14:51:10 · 192 阅读 · 0 评论