![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Algorithm and Data Structure
RichardYSteven
这个作者很懒,什么都没留下…
展开
-
1001 Exponentiation
DescriptionProblems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many comp原创 2008-10-28 20:01:00 · 987 阅读 · 0 评论 -
随机数算法
<br />/*<br /> * =====================================================================================<br /> *<br /> * Filename: random_number.c<br /> *<br /> * Description: <br /> *<br /> * Version: 1.0<br /> * Cr原创 2010-10-23 20:32:00 · 1043 阅读 · 0 评论 -
Binary Search Tree
#ifndef __BINARYTREE_H__#define __BINARYTREE_H__#include using namespace std;#include "Stack.h"#include "Queue.h"template class TNode{public: C data; TNode *lchild; TNode *rchild; TNode():lchild(NU原创 2010-10-06 18:23:00 · 834 阅读 · 0 评论 -
Quick Sort
这是一个实际中常用的算法,虽然最差情况的复杂度是O(n^2),但是平均复杂度是O(nlgn)。且是in place的。/* * ===================================================================================== * * Filename: quick_sort.c * * Description: A sorting algorithm with average O(nlgn)原创 2010-10-02 10:06:00 · 1602 阅读 · 0 评论 -
Heap Sort 及其应用
<br />Heap Sort是一个时间复杂度为O(nlgn)的排序算法,且是in place的,不需要额外的存储空间。<br /> <br />其中有一个重要的应用是,我们要取到某组数中的最大(最小)的前几个数。<br />这样只要做HeapSort的前几个循环就可以了。<br />因为BuildMaxHeap的复杂度为O(n), MaxHeapify的复杂度为O(lgn),所以求最大(最小)数的复杂度就是O(n)了。<br /> <br />/*<br /> * ==================原创 2010-10-01 21:16:00 · 1082 阅读 · 0 评论 -
Link List
// =====================================================================================// // Filename: LinkList.cpp// // Description: // // Version: 1.0// Created: 10/03/2010 06:23:22 PM// Revision: none原创 2010-10-03 20:01:00 · 876 阅读 · 0 评论 -
求解迷宫算法 递归法
/* * ===================================================================================== * * Filename: maze.cpp * * Description: * * Version: 1.0 * Created: 09/26/2010 07:20:53 AM * Revision: none *原创 2010-09-27 17:14:00 · 1338 阅读 · 0 评论 -
求解迷宫算法 迭代法
不是我写的,好好学习一下/* * ===================================================================================== * * Filename: maze.c * * Description: * * Version: 1.0 * Created: 09/26/2010 07:20:53 AM * Revision:原创 2010-09-26 07:55:00 · 1219 阅读 · 0 评论 -
一个简单的队列实现
1。 当front==rear时,队列为空2。 当 (rear+1)%MAX_QUEUE_SIZE == front 为满// =====================================================================================// // Filename: Queue.cpp// // Description: // // Version: 1.0// Cr原创 2010-09-24 12:12:00 · 823 阅读 · 0 评论 -
算法运行时间、logN、NlogN 之间的比较
<br />http://clarkluo2004.blog.163.com/blog/static/32973801200845115213422/<br />这个帖子说的非常好啊<br /> 1 大部分程序的大部分指令之执行一次,或者最多几次。如果一个程序的所有指令都具有这样的性质,我们说这个程序的执行时间是常数。 logN 如果一个程序的运行时间是对数级的,则随着N的增大程序会渐渐慢下来,如果一个程序将一个大的问题分解成一系列更小的问题,每一步都将问题的规模缩减成几分之一,一般就会出现这样原创 2010-09-09 10:21:00 · 36575 阅读 · 0 评论 -
一个简单的栈的实现
// =====================================================================================// // Filename: Stack.cpp// // Description: // // Version: 1.0// Created: 09/06/2010 09:47:52 PM// Revision: none//原创 2010-09-19 22:00:00 · 1003 阅读 · 0 评论 -
习题解答
http://www.cise.ufl.edu/~sahni/fdsc2ed/原创 2009-12-06 20:46:00 · 874 阅读 · 0 评论 -
Links for Algorithm
http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/原创 2009-03-05 17:14:00 · 705 阅读 · 0 评论 -
计算余数
#include int naive_mod(const char* m, const int n){ int remainder = 0; int num = 0; while (*m) { num = num*10 + *m-0; remainder = (remainder * 10 + (*m++ - 0)) % n;原创 2008-12-01 18:24:00 · 1017 阅读 · 0 评论 -
Peterson's solution for achieving mutual exclusion
#define FALSE 0#define TRUE 1#define N 2 /* number of processes */int turn; /* whose turn is it? */int interested[N]; /转载 2009-02-02 22:09:00 · 1039 阅读 · 0 评论 -
北大acm 题型分类
北大ACM-题型分类 http://acm.pku.edu.cn/主流算法: 1.搜索 //回溯 2.DP(动态规划) 3.贪心 4.图论 //Dijkstra、最小生成树、网络流 5.数论 //解模线性方程 6.计算几何 //凸壳、同等安置矩原创 2008-10-29 11:11:00 · 1311 阅读 · 0 评论 -
动态规划 和 背包问题的一个讲座
http://www.oiers.cn/pack/Index.html#sec5 数组分割问题http://blog.csdn.net/qq675927952/archive/2011/03/24/6275077.aspx转载 2011-07-01 14:06:00 · 779 阅读 · 0 评论