摘要: Ex2.1-4Problem description:Input: two arrays lhs and rhs which store two n-bit binary numbers respectivelyOutput: one array that stores an n+1-bit bin... 阅读全文
posted @ 2015-05-03 23:02 Pxjw 阅读(468) 评论(0) 推荐(0) 编辑
摘要: CODE:https://github.com/pxjw/Principles-of-Compiler/tree/master/consDFA原题:1、自己定义一个简单语言或者一个右线性正规文法示例如(仅供参考) G[S]:S→aU|bV U→bV|aQ V→aU|bQ Q→aQ|bQ|e2、构造其... 阅读全文
posted @ 2015-04-21 20:31 Pxjw 阅读(18770) 评论(3) 推荐(0) 编辑
摘要: Vector表示可以改变大小的数组容器。就像数组,其元素的向量使用连续的存储位置,这意味着还可以访问其元素上使用偏移量经常指向元素的指针,和在数组中一样有效。但与数组不同,其大小可动态变化,他们的存储容器自动处理。在vector内部,使用动态分配的数组向量来存储他们的内容。此数组可能需要重新分配,以... 阅读全文
posted @ 2015-04-10 15:08 Pxjw 阅读(3305) 评论(0) 推荐(0) 编辑
摘要: 全部代码参见Github:https://github.com/pxjw/MITx-6.00.1-2-Problem-Set/tree/master/6.00.1x/proSet3HANGMAN PART 1: IS THE WORD GUESSED?Please read the Hangman ... 阅读全文
posted @ 2015-03-09 18:49 Pxjw 阅读(4028) 评论(0) 推荐(0) 编辑
摘要: c++复合运算成员函数,友元,运算符重载。代码基于VisualStudio 2013update 4Etc.// diyTypeCal.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include//复数运算class Complex{protected:dou... 阅读全文
posted @ 2015-02-12 22:32 Pxjw 阅读(938) 评论(0) 推荐(0) 编辑
摘要: 寻找素数因子要求用书中的smallest-divisor过程找出199, 1999, 19999的最小因子。Scheme Code:主要流程:定义寻找素数的过程如果2的平方即4,大于测试值,那么它肯定是素数如果n能和2整除,那么不是素数,最小因子是2如果不是,回到过程find-div,再试试能不能与... 阅读全文
posted @ 2015-01-23 19:21 Pxjw 阅读(604) 评论(0) 推荐(0) 编辑
摘要: 使用Scheme的对数迭代法:#lang racket;;N是偶数:b^n = (b^(n/2))^2(define (square x) (* x x));定义乘积函数(define (fast-expt b n);筛选 (expt-iter b n 1))(define (expt-iter ... 阅读全文
posted @ 2015-01-20 17:32 Pxjw 阅读(938) 评论(0) 推荐(0) 编辑
摘要: 程序由Scheme语言编写,待会上别的语言实现。#lang racket;斐波那契对数法;筛选(define (fib n) (fib-iter 1 0 0 1 n)) (define (square x) (* x x)) (define (fib-iter a b p q count) (... 阅读全文
posted @ 2015-01-19 20:41 Pxjw 阅读(537) 评论(0) 推荐(0) 编辑
摘要: MS SQL SERVER数据库1.创建数据库create database javateam;2.使用数据库use javateam;3.创建表create table 表名( 字段名 字段类型 主键 字段增长(从X开始 , 每次加X个), 字段名 字段类型, 字段名 字段类型);create t... 阅读全文
posted @ 2015-01-16 18:33 Pxjw 阅读(586) 评论(0) 推荐(0) 编辑
摘要: 题目: 采用递归计算过程计算出帕斯卡三角形的各个元素。row:0 11 1 12 1 2 13 1 3 3 14 1 4 6 4 15 . . . . . .col: 0 1 2 3 4//c++//递归#includeusing namespace std;int pascaler(int row... 阅读全文
posted @ 2015-01-14 12:46 Pxjw 阅读(493) 评论(0) 推荐(0) 编辑