摘要: 下面的代码是在VS2010中运行过的,是单链表的两种构造方法:头插法与尾插法。#include "stdafx.h"#include #include #include using namespace std; struct ListNode { int m_nValue; ListNode * m_pNext;};//头插法,从头部插入,即最后输入的元素为单链表的第一个元素ListNode *CreateList(){ ListNode *node = NULL; ListNode *s; int value; cin >> value; while... 阅读全文
posted @ 2013-10-04 21:55 zm880122 阅读(505) 评论(0) 推荐(0) 编辑
摘要: 下面的代码是在VS2010中编译过的,运行正确。////////sort.h/////////////////////#ifndef _SORT_H_#define _SORT_H_templateclass CSort{private: //QuickSort,SelectSort,HeapSort均使用 void swap(T *left, T *right); //the following three functions are for HeapSort() void FilterDown(T x[], const int i, const int n); ... 阅读全文
posted @ 2013-10-04 21:51 zm880122 阅读(450) 评论(0) 推荐(0) 编辑