数据结构
c/c++数据结构学习总结
江南又旧雨
踏踏实实,简简单单,实实在在,做好当前,做好每一天!低头走路,莫问前程。
展开
-
c/c++模板实现链表、栈、列队
一、模板数组实现栈#include<iostream>using namespace std;const int SiZE=10;template<typename Type>class myStack{public: void init_stack() { stackTail= -1; } int pushStack(Type elm);...原创 2020-02-17 20:25:06 · 288 阅读 · 0 评论 -
c语言_数制转换_任意进制间互相转换
一、任意进制间互相转换(链表结构实现)#include "stdio.h"#include"stdlib.h"#include <math.h>typedef struct node{ char elem; struct node *next;}stackLink;stackLink *stackPush(stackLink *top, char elem)...原创 2020-02-16 17:58:21 · 1410 阅读 · 0 评论 -
c语言_面试_十进制转换为二进制_数据取反(位域操作)
一、二、数据取反(位域操作)typedef union{ char uint8Num; struct { int bit0 : 1; int bit1 : 1; int bit2 : 1; int bit3 : 1; int bit4 : 1; int bit5 : 1; int bit6 : 1; int bit7 : 1; }u8Bit;}...原创 2020-02-16 16:32:25 · 953 阅读 · 0 评论 -
c语言_队列结构
一、不变顺序表(数组)实现列队列队会有用完的时候,用过的位置不再使用。#include"stdio.h"int enQueue(int *arry, int rear, int data){ arry[rear] = data; rear++; return rear;}void deQueue(int *arry, int& front, int&...原创 2020-02-16 15:52:18 · 357 阅读 · 1 评论 -
c语言_栈结构
代码:#include"stdio.h"#define STACK_SIZE 5int pushStack(char *arry, int top, char elem){ top++; if (top ==STACK_SIZE) { printf("栈已经满无法进栈\n"); return top - 1; } arry[top] = elem; return ...原创 2020-02-16 15:10:00 · 235 阅读 · 0 评论 -
c语言_顺序表(可变数组,变长数组,VLA)
一、#include"顺序表.h"#define Size 10typedef struct Table{ int *head;//声明一个名为head的、长度不确定的数据 int length;//记录当前顺序表的长度 int size;//记录顺序表的分配的存储容量}table;table initTable();int selectTable(table t,...原创 2020-02-16 14:53:52 · 748 阅读 · 0 评论 -
c语言_双向链表代码
一、bidirectionalListTable.h文件typedef struct Node{ struct Node *prior; int elem; struct Node *next;}node;#define initTableSize 5node * initTable(int n);void displayTable(node *head);int sele...原创 2020-02-15 15:06:17 · 745 阅读 · 0 评论 -
c语言_单向链表代码
一、LinkTable.h文件//LinkTable结构体实现typedef struct Link{ int elem; struct Link *next;}node;#define initTableSize 5node * initLinkTable();int selectElem(node *p, int elem);node *amendElem(node ...原创 2020-02-15 14:53:52 · 231 阅读 · 0 评论