显示下一条  |  关闭

This is Chipset!

网易博客功能真垃圾!

 
 
 
 

自定义模块

 
 
模块内容加载中...
 
 
 
 
 
 
 

[置顶] 一个C++编译器的不完全列表

2009-1-2 14:34:04 阅读93 评论0 22009/01 Jan2

作者  | 2009-1-2 14:34:04 | 阅读(93) |评论(0) | 阅读全文>>

[置顶] C++的应用

2008-11-25 21:36:37 阅读112 评论2 252008/11 Nov25

作者  | 2008-11-25 21:36:37 | 阅读(112) |评论(2) | 阅读全文>>

集成开发环境对比

2009-3-19 20:37:26 阅读52 评论0 192009/03 Mar19

作者  | 2009-3-19 20:37:26 | 阅读(52) |评论(0) | 阅读全文>>

红黑树的设计和实现

2008-12-15 0:23:08 阅读33 评论0 152008/12 Dec15

红黑树是一种比较重要的数据结构,但是很多数据结构和算法的书上仅仅粗略的介绍,尤其国内出版的数据结构和算法教材,很多甚至只字不提。鉴于此,这里给出一些简明扼要的介绍,并给出C++实现的代码。
一棵红黑树是指一棵满足下述性质的二叉搜索树(BST, binary search tree):
1. 每个结点或者为黑色或者为红色。
2. 根结点为黑色。
3. 每个叶结点(实际上就是NULL指针)都是黑色的。
4. 如果一个结点是红色的,那么它的两个子节点都是黑色的(也就是说,不能有两个相邻的红色结点)。
5. 对于每个结点,从该结点到其所有子孙叶结点的路径中所包含的黑色结点数量必须相同。

下图中描述的是插入和删除一个节点用到的基本原理。[注意:旋转变色方法有多种,下图仅给出一种]

作者  | 2008-12-15 0:23:08 | 阅读(33) |评论(0) | 阅读全文>>

functional

2008-12-15 0:20:30 阅读22 评论0 152008/12 Dec15

#ifndef FUNCTIONAL_H_
#define FUNCTIONAL_H_

template <class Arg, class Result>
struct unary_function
{
    typedef Arg argument_type;
    typedef Result result_type;
};

template <class Arg1, class Arg2, class Result>
struct binary_function
{
    typedef Arg1 first_argument_type;
    typedef Arg2 second_argument_type;

作者  | 2008-12-15 0:20:30 | 阅读(22) |评论(0) | 阅读全文>>

iterator

2008-12-15 0:15:30 阅读31 评论0 152008/12 Dec15

#ifndef ITERATOR_H_
#define ITERATER_H_

#include <cstddef>
using std::ptrdiff_t;

struct input_iterator_tag {};
struct output_iterator_tag {};
struct forward_iterator_tag : public input_iterator_tag {};
struct bidirectional_iterator_tag : public forward_iterator_tag {};
struct random_access_iterator_tag : public bidirectional_iterator_tag {};

template <class

作者  | 2008-12-15 0:15:30 | 阅读(31) |评论(0) | 阅读全文>>

type_traits

2008-12-15 0:14:28 阅读34 评论0 152008/12 Dec15

#ifndef TYPE_TRAITS_H_
#define TYPE_TRAITS_H_
#include <wchar.h>

struct false_type {};
struct true_type {};

template <class type>
struct type_traits
{
   typedef true_type     this_dummy_member_must_be_first;

   typedef false_type    has_trivial_default_constructor;
   typedef fal

作者  | 2008-12-15 0:14:28 | 阅读(34) |评论(0) | 阅读全文>>

memory

2008-12-15 0:12:52 阅读24 评论0 152008/12 Dec15

#ifndef MEMORY_H_
#define MEMORY_H_
#include <cstddef>
#include <new>
#include <cstring>

using std::size_t;
using std::ptrdiff_t;

#include "type_traits.hpp"
#include "pair.hpp"
#include "iterator.hpp"

template <typename T>
static inline T* allocate(size_t n, T*) { return (T*)(operator new(n * sizeof (T))); }

template <typename T, typename Value>

作者  | 2008-12-15 0:12:52 | 阅读(24) |评论(0) | 阅读全文>>

Why Java Will Always Be Slower than C++

2008-11-26 16:27:00 阅读46 评论0 262008/11 Nov26

by Dejan Jelovic

 

"Java is high performance. By high performance we mean adequate. By adequate we mean slow." - Mr. Bunny

 

Anybody that has ever used a non-trivial Java program or has programmed in Java knows that Java is slower

作者  | 2008-11-26 16:27:00 | 阅读(46) |评论(0) | 阅读全文>>

约索夫环问题用数组实现

2008-11-17 21:33:09 阅读25 评论0 172008/11 Nov17

#include <iostream>
#include <cstdlib>
#include <vector>                                   //当作数组用
#include <ctime>

void output_format(size_t d)                   //格式化输出一点信息
{
  if(d % 100 == 11 || d % 100 == 12 || d % 100 == 13)
    std::cout << "th";
  else
    switch(d % 10)
    {
      case 1: std::cout << "st"; break;
      case 2: std::cout << "nd"; break;

作者  | 2008-11-17 21:33:09 | 阅读(25) |评论(0) | 阅读全文>>

查看所有日志>>

 
 
 
 
 
 我要留言
 
 
 
留言列表加载中...
 
 
 
 
 
 
 
 
模块内容加载中...
 
 
 
 
 
 
 

 N/A

 发消息  写留言

 
http://www.cppblog.com/chipset
 
博客等级加载中...
今日访问加载中...
总访问量加载中...
最后登录加载中...
 
 
 
 
 
 
 
心情随笔列表加载中...
 
 
 
 
 
 
 
列表加载中...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2012

   
创建博客 登录  
 关注