I'm going to define a class, and in particular, what I'm going to do, is walk through what that says.
我们碰到了一个问题,这个问题就是,我们想要建立,一个抽象数据类型。
That's, and you have lots and lots of data, but you need some, you know, expertise to analyze the data,
虽然你有很多很多的数据,但你要知道怎么分析,
Data's what we expect. It's our way of representing fundamentally the kinds of information we want to move around.
数据是我们一直需要的,它是用来表达我们想要操作的,数据类型的基本方式,这里。
I was able to do letter writing, I was able to do data collection, and do a product there.
我以前上书信写作的课,要上数据搜集的课,还要上美工课。
Instead if we want this pointer to represent the address of something in as much as it points at that address let's just draw an arrow.
如果我们想要让这个指针表示,数据的地址,它指向的地址,我用一个箭头表示。
We treat the dashboard, we treat the analytics, we treat the data as a product.
我们要管理控制台,管理分析,要像管理产品一样管理数据。
Everything's got to be in the right units.
每个数据都要有合适的单位
And here, I'm going to suggest we've seen numbers, we've seen strings, and I'm going to add Booleans here as well.
我要提醒下大家我们学习过数字数据了,学习过字符串了,今天还要学习布尔类型,这是当我们谈到条件的时候。
This is useful especially when we get to details like forensics and looking at data on a hard drive, - 'cause if you don't know how much store-- how many bits are composing your file, you're never gonna recover that data or be able to access what you're looking for.
这是很有用的,尤其是在法庭上,查看硬盘驱动器里的数据时,如果你连-,文件有多少比特都不知道,你如何去恢复数据,获取你想要的信息呢。
We want to do the same thing, but with our data types.
我们想要创建数据类型和函数,或者我们会叫他们方法。
So the enrollment numbers are in and we thought we would share some statistics, as we like to do in this course; being computer scientists, we tend to gather lots of data.
登记加入我们的人数在这里,并且我们觉得我们能分享一些统计资料,我们在这次课程中也喜欢这么做,作为计算机科学家,我们要收集很多数据。
So we're to assume we can get to any piece of data, any instruction in constant time, and the second assumption we're going to make is that the basic primitive steps take constant time, same amount of time to compute. Again, not completely true, but it's a good model, so arithmetic operations, comparisons, things of that sort, we're all going to assume are basically in that in that particular model.
因此如果我们假设在恒定的时间内,我们可以取得任何一块数据,任何一种数据结构的话,我们要做的第二个假设就是,基本的原始操作计算花费的时间是恒定的,这个假设也不是完全正确的,但这个模型其实挺不错的,因此算法操作,比较,这一类的事情,我们在这个特定的模型中都假设是基本的,操作,花费的时间是恒定相同的。
And I haven't said yet, how do I get that collection, but you could certainly conceptualize that, if I had that collection, that would be nice thing to do. That is a more common pattern.
也可以这么来操作,这是个更常用的模式,这基本上也就意味着,对于某些数据的集合,我想要一个循环机制。
We have to interpret the data differently.
我们要用不同的角度理解数据
This is convention, so on almost-- and most any computer you overuse, if you're writing code that uses a char, you're gonna be handed 8 bits or 1 byte to store that particular char.
这是约定,对于大多数-,电脑,当你写代码要用到一个char型数据时,必须先预留8比特或1字节,的空间来存储这个char型数据。
They're a third kind of value that we saw when we started talking about conditions.
要去学习的第三种数据类型,我们已经学习过了,通过基础数据。
Well basically what we're doing is we're giving ourselves the ability to create data types the same way that we have some built-ins, so we have things like int, float, string, these are built-in data types.
就是要赋值我们自己创建,和内置的数据类型,相同的数据类型的能力,我们有一些内置的数据类型,如int,float,string等,如果你考虑下这些数据类型。
To do that the data travels from RAM along with software signals that tell the hard drive how to store that data.
为了能让数据从RAM中,到硬盘是要使用软件信号告诉硬盘,如何存储这些数据。
Scheme And I happen to like Lisp and Scheme, it's a great language when you're trying to deal with problems where you have arbitrarily structured data sets.
而且我很偶然的喜欢上了Lisp和,这些是当你要试图解决你,曾经很武断的设置数据,的地方的问题时很棒的语言。
In my in my area of research, it's common for us to want to process about 100 images a second in order to get real time display. Each image has about a million elements in it. I 've got to process about a half a gig of data a second in order to get anything out of it.
在我们的研究领域内,我们经常要在一秒钟内处理大概,100张图片以获得实时显示,每个图片大概包括了100万像素,因此我必须在1秒内,处理半个G的数据,来获取我想要的。
So it's an address, it's a pointer, address pointer, synonyms for now, so it's the address of a char so this makes sense because s1 is also the address of a char so if I wanted to make a copy of that address this is absolutely the right syntax.
是一个地址,是一个指针,地址指针,也就是,char型数据的地址,这是有意义的,因为s1也是一个char型数据的地址,所以如果我想要复制那个地址,这个绝对是正确的语法。
And I don't quite remember from reading or from class how big these things are, well, it turns out -- and this is sometimes useful, later on more likely than now -- but C has a size of operator that takes an argument in parenthesis and it will tell you how much space is used to store that particular data type.
我不太记得类中的这些类型,是多大的,嗯,结果是--这个在以后比现在,可能是更有用的--不过C语言中有个sizeof的操作符,其中括号里有一个参数,它会告诉我们,要存储一个类型的数据,需要占用多大空间。
应用推荐