REQg


  • 首页

  • 标签

  • 分类

  • 归档

  • 搜索

NEWS Rocket Launches, Trips to Mars and More 2020 Space and Astronomy Events

发表于 2020-01-02

Rocket Launches, Trips to Mars and More 2020 Space and Astronomy Events

From New York Times
By Michael Roston Jan. 1, 2020

Spectators viewing the launch of a Soyuz rocket carrying crew to the International Space Station from the Baikonur Cosmodrome in Kazakhstan in September.(9月,在哈萨克斯坦拜科努尔航天发射场,观看联盟号运载火箭将宇航员送往国际空间站的观众)Credit…Dmitri Lovetsky/Associated Press

1
2
3
4
5
6
7
8
9
10
Spectator
n. (尤指体育比赛的) 观看者,观众;
Soyuz
网络 联盟号; 联盟号飞船;
Baikonur
网络 拜科努尔;
Cosmodrome
n. 航天站;人造卫星发射基地;
Kazakhstan
n. 哈萨克斯坦;

If you follow space news and astronomy, the past year offered no shortage of highlights. Astronomers provided humanity’s first glimpse of a black hole. China landed on the moon’s far side. And the 50th anniversary of the Apollo 11 moon landing inspired us to look ahead to our future in space.

如果你关注太空新闻和天文学,你会发现过去的一年里不乏精彩的亮点。天文学家让人类第一次看到了黑洞。中国在月球的背面着陆。阿波罗11号登月50周年纪念日激励我们展望我们在太空的未来。

1
2
3
4
5
6
7
8
astronomy
n. 天文学;
shortage
n. 不足; 缺少; 短缺;
anniversary
n. 周年纪念日;
Apollo
n. 阿波罗; 太阳; 美男子;

The year to come will be no less eventful:

未来的一年将是多事之秋:

1
2
eventful
adj. 充满大事的; 多事故的; 多变故的;

No fewer than four missions to Mars could leave Earth this summer.

今年夏天,至少有四次前往火星的任务将离开地球。

NASA may finally launch astronauts into orbit aboard capsules built by SpaceX and Boeing.

美国国家航空航天局(NASA)可能最终会用SpaceX和波音公司制造的太空舱将宇航员送入轨道。

1
2
3
capsule
n. (装药物的) 胶囊; (装物或装液体的) 小塑料容器; 太空舱; 航天舱;
vt. 压缩; 简述; 以瓶盖密封;

We expect to learn more secrets about the interstellar comet Borisov.

1
2
3
4
interstellar
adj. 星际的;
comet
n. 彗星; 扫帚星;

And private companies are working to demonstrate new abilities in space.

私营公司正在努力展示他们在太空的新能力。

However much you love space and astronomy, it can be challenging to keep up with the latest news in orbit and beyond. That’s why we’ve put dates for some of these events on The Times’s Astronomy and Space Calendar, which has been updated for 2020. Subscribe on your personal digital calendar to be automatically synced with our updates all year long. (We promise not to collect any personal information from your private calendar when you sign up.)

无论你多么热爱太空和天文学,要跟上轨道内外的最新新闻都是很有挑战性的。这就是为什么我们把其中一些事件的日期放在时报的天文和太空日历上,后者已经更新到2020年。在您的个人数字日历上订阅,它将自动与我们全年的更新同步。(我们承诺在您注册时不会从您的私人日历中收集任何个人信息。)

Sync your calendar with the solar system.(将你的日历与太阳系同步)

Below are some of the launches, space science and other events to look forward to.

以下是一些发射、空间科学等值得期待的活动。

A crowd heads to Mars

The Mars 2020 rover in a clean room of NASA’s Jet Propulsion Laboratory in Pasadena, Calif., earlier this month.Credit…JPL-Caltech/NASA

Roughly every two years, the orbits of Earth and Mars come closer than usual. Space agencies on Earth often send missions to the red planet during that window, and in 2020 four such launches are scheduled.

Three of the missions will carry rovers. The United States is launching the soon-to-be-renamed Mars 2020 rover, which also carries a small helicopter. It will try to land in Jezero Crater, which once contained a lake and could preserve evidence of life, if life ever existed there.

Neither China, Europe nor Russia has deployed a rover on the Martian surface. But they will try, in a pair of missions. China’s mission, its first on its own to the red planet, includes an orbiter in addition to a rover. The European Space Agency and Russia cooperated to build Rosalind Franklin, a rover named for the English chemist whose work was essential to finding the structure of DNA.

The rovers could be joined on Mars by Hope, an orbiter commissioned by the United Arab Emirates. It is being built in Colorado, and is to be launched on a Japanese rocket. If it succeeds, it could represent a new model for space programs, in which small, wealthy countries pay for off-the-shelf spacecraft to get themselves into orbit and beyond.

Renewed human spaceflight from the United States

SpaceX employees worked on the Crew Dragon spacecraft at SpaceX’s Hawthorne, Calif., headquarters in October.Credit…Philip Pacheco/Agence France-Presse — Getty Images

Since the space shuttle’s last flight, in 2011, NASA has relied on Russia’s Soyuz spacecraft for trips to and from the International Space Station. In 2019, NASA hoped to begin flying astronauts aboard capsules built by two private companies, SpaceX and Boeing, but persistent delays knocked back the timeline another year.

NASA’s commercial crew program could finally achieve its goal in 2020. SpaceX’s Crew Dragon is scheduled to conduct an uncrewed test of its in-flight abort system on Jan. 11. If the test succeeds, the capsule could carry astronauts to the space station not long after.

Boeing’s Starliner experienced problems during its first uncrewed test flight in December and was unable to dock with the space station. An upcoming review of that test will determine whether Starliner might still be able to fly into orbit with astronauts in the first half of this year.

Private spaceflight seeks new heights

The Virgin Galactic SpaceShipTwo returning to Earth at the Mojave Air and Space Port in California in February.Credit…Gene Blevins/Reuters

Virgin Galactic, the space-plane company run by Richard Branson, conducted two successful test flights with crew aboard in the past 13 months. In the year to come, the company could carry its first passengers to the edge of space. Blue Origin, the company founded by Jeff Bezos of Amazon, may follow suit; it has conducted 12 crewless tests of its capsule for short tourist jumps to suborbital space. For now, only the very wealthy will be able to afford such jaunts.

Other private companies are looking to Earth orbit for the future of internet service. SpaceX launched 120 Starlink satellites in 2019 and could launch many more in 2020. A competitor, OneWeb, could send more of its satellites to orbit in the coming year, too. These companies are blazing the trail for orbital internet — a business that Amazon and Apple are also pursuing — and upsetting astronomers, who fear that large constellations of internet satellites will imperil scientific study of the solar system and stars.

A comet exits the solar system

The Comet 2I/Borisov, seen by the Hubble Space Telescope during its closest approach to the sun this month.Credit…European Southern Observatory/EPA, via Shutterstock

In September, a comet called Borisov 2I was spotted in our solar system, only the second ever confirmed interstellar object. Unlike Oumuamua, which was spotted in 2017 only as it was leaving the solar system, astronomers caught sight of Borisov and its 100,000-mile-long tail as it flew toward the sun, before it turned and began its exit.

In 2020, scientists will continue to point ground and orbiting telescopes at Borisov as it speeds back toward the stars beyond — unless, as some astronomers hope, it explodes into fragments after being heated by the sun. Whatever happens, other interstellar visitors are sure to follow, and professional sky gazers hope to find them with powerful new telescopes in the years ahead.

Bits of giant space rocks return to Earth

Japan’s Hayabusa-2 spacecraft landing in July on an asteroid to collect samples, which could be brought to Earth in December 2020.Credit…JAXA, via Associated Press

Japan’s Hayabusa2 spacecraft concluded several close encounters with Ryugu, a near-Earth asteroid, last year. It twice collected samples from Ryugu’s surface, the second time after dropping what amounted to a bomb on the space rock’s surface. At the end of 2019, the probe began its trip home. Near the end of this year, it will try to jettison its samples back to Earth’s surface, in the Australian outback. Scientists hope to study the material for clues from the solar system’s early days.

Hayabusa2 wasn’t the only spacecraft circling a space rock. NASA’s Osiris-Rex spent the year completing a close survey of Bennu, a different, boulder-strewn asteroid. The mission’s managers selected a site called Nightingale for a specimen-collection operation that they plan to carry out in August. That spacecraft will return its cargo to Earth in 2023.

The moon gets another visitor

China’s lunar rover Yutu-2 on the far side of the moon, in an image taken by the Chang’e-4 lunar probe in January.Credit…China Stringer Network/Reuters

China started 2019 by landing on the lunar far side, an accomplishment never before attempted by any of the world’s space agencies. That was the good news. In April, another potential lunar lander — Beresheet, built by an Israeli nonprofit — crashed on the moon’s surface. And in September, Vikram, a lander built by India’s space agency, crashed near the lunar South Pole.

Before the end of 2020, the moon could see one more visitor from Earth. Chang’e-5, a robotic probe built by China, aims to collect moon rock and soil samples and send them back to Earth. The last set of lunar samples was gathered in 1976 by a Soviet spacecraft.

The year to come may also bring greater clarity about American designs for returning to the moon. NASA is aiming to put the first woman and the next man on the moon by 2024, with a program called Artemis. A wide range of political, budgetary and technological hurdles stand in the way of meeting that ambitious timeline.

NEWS Trump says he will sign ‘phase one’ China trade deal on Jan. 15 at the White House

发表于 2020-01-02

Trump says he will sign ‘phase one’ China trade deal on Jan. 15 at the White House

From CNBC
https://www.cnbc.com/2019/12/31/trump-says-he-will-sign-phase-one-china-trade-deal-jan-15-at-the-white-house.html

KEY POINTS
President Donald Trump says he will sign the “phase one” trade deal with China at the White House on Jan. 15.
The president says he will travel to Beijing “at a later date” to start talks toward a second part of the trade agreement.

President Donald Trump plans to sign the “phase one” trade deal with China at the White House on Jan. 15.

In a tweet Tuesday morning, the president said “high level representatives of China” will attend the signing. Trump added that he will travel to Beijing “at a later date” to start talks toward a second piece of the trade pact.

1
2
tweet
n. (小鸟的) 唧啾,吱喳;

I will be signing our very large and comprehensive Phase One Trade Deal with China on January 15. The ceremony will take place at the White House. High level representatives of China will be present. At a later date I will be going to Beijing where talks will begin on Phase Two!

— Donald J. Trump (@realDonaldTrump) December 31, 2019

The White House did not immediately respond to a request to comment on which top Chinese officials will be present at the signing. Reports this week indicated Chinese Vice Premier Liu He, Beijing’s top trade negotiator, could sign the agreement.

1
2
3
indicated
v. 表明; 显示; 象征; 暗示; 间接提及; 示意;
[词典] indicate的过去分词和过去式;

The world’s two largest economies reached a partial trade deal earlier this month as they try to de-escalate a simmering trade war. Under the pact, Washington agreed to cancel some new tariffs and reduce rates for other duties, and China said it would buy more U.S. agricultural products. It also includes changes related to intellectual property and technology.

1
2
3
4
5
6
7
de-escalate
v. (使) 逐步降级;
simmering
v. 用文火炖; 煨; 充满(难以控制的感情,尤指愤怒); 即将爆发; 酝酿;
[词典] simmer的现在分词;
pact
n. 条约; 协议; 公约;

The two sides have worked in recent weeks to hash out the agreement’s language.

1
2
hash out
vt. 具体讨论;

Trump sees striking a broad trade agreement and cracking down on Chinese trade abuses as a priority ahead of his 2020 reelection bid. The tariff battle between the U.S. and China has worried investors, who fear it will drag on economic growth.

1
2
3
4
5
6
7
8
9
10
crack down on
[词典] 处罚,制裁;
reelection
网络 连任; 再选; 再次竞选; 改选; 重选;
bid
v. 出(价); (尤指拍卖中) 喊价; 投标; 努力争取; 企图获得;
n. 买方的出价; 投标; 努力争取;
v. 向(某人)问候、道别等; 告诉(某人做某事); 吩咐;
drag on
[词典] 不必要地拖延; 拖得过久;

Earlier Tuesday, Trump trade advisor Peter Navarro — who has called for tougher measures to crack down on China than many in the White House — told CNBC that the deal has “great stuff in it.” He pointed to provisions related to intellectual property theft and access to financial markets.

1
2
3
4
tougher
adv. 强硬地; 顽强地;
adj. 艰苦的; 艰难的; 棘手的; 严厉的; 强硬的; 无情的; 坚强的; 健壮的; 能吃苦耐劳的; 坚韧不拔的;
[词典] tough的比较级;

Trump, who once suggested he would prefer to wait until after the 2020 election to strike a trade deal with China, is now pushing to move forward with a second phase.

Under the first piece of the agreement, the U.S. canceled tariffs that were set to take effect earlier this month. The White House will leave 25% duties on $250 billion in Chinese goods in place, and cut existing tariffs on another $120 billion in products to 7.5%.

good sentences

发表于 2020-01-01

January

Education is not merely the transmission of knowledge and skills.
教育不仅仅是知识与技能的传播。

While all of these countries face their own challenges,there are a number of consistent themes.
尽管所有的国家都面临自己的挑战,但仍有许多一致的主题。

We want to solve this problem without resorting to violence.
我们想解决这个问题,但不能诉诸暴力。

Price is proportional to costs.
价格与成本是成比例的。

Increased competition makes it essential for the business to innovate.
日益激烈的竞争使得企业有必要创新。

Ancient wisdom has stood the test of time.
古老的智慧已经经受了时间的考验。

Give us a call if you have any queries.
如果有任何疑问,请给我们致电。

The youngsters must perceive the relationship between success and effort.
年轻人必须认识到成功与努力之间的关系。

Growing levels of pollution represent a serious health hazard to the local population.
日益严重的污染对当地居民的健康构成了重大威胁。

tourists from every corner of the globe
来自世界各地的游人

What’s the difference between success and mediocrity?
成功与平庸有什么不同?

PAT

发表于 2019-12-29

政治

发表于 2019-12-14

作文

发表于 2019-12-12

材料

5G is the fifth generation of wireless technology. But users will know it as one of the fastest, most robust technologies the world has ever seen.

That means quicker downloads, outstanding network reliability and a spectacular impact on how we live, work and play. The connectivity benefits of 5G will make businesses more efficient and give consumers access to more information faster than ever before. Super-connected autonomous cars, smart communities, industrial IoT, immersive education—they all will rely on 5G.

“In the future, everything is going to be transformed by 5G,” says Verizon CEO Hans Vestberg. “The pace of technological change in decades past has been fast. The only thing we know for sure is that, in the future, it’s going to be even faster. We’re going to experience a technological shift that will transform people, businesses and society as a whole.”

Verizon is working tirelessly to roll out 5G on a massive scale. But what exactly is 5G? How does it work? How fast is it, really? And how will it change people’s lives? We answer those questions, and more, below.

What is 5G used for?

A more appropriate question might be, “What can’t 5G be used for?” Rich, complex information is freed to move at scarcely imaginable speeds. Those speeds, combined with lowered latency, will have far-reaching effects on every sector of the economy.

AR and VR applications can work seamlessly. Industrial machinery and robotics can be controlled remotely. Feature-length HD movies can be downloaded faster than you can read this sentence.

Jack Ma

A former English teacher, Jack Ma cofounded Alibaba Group, one of the world’s largest e-commerce businesses.
In September 2019, Jack Ma stepped down as Alibaba’s executive chairman; he is succeeded by CEO Daniel Zhang.
Its 2014 IPO in New York set a record as the world’s biggest public stock offering, raising $25 billion.
Ma’s investments beyond Alibaba include stakes in Chinese entertainment industry firms Huayi Brothers and Beijing Enlight Media.

小作文

2010仿写

Dear Jack,
I am writing this letter to express my heartfelt gratitude to you for your warm reception during my participation in the cultural program in your country.
Your hospitality and genuiness indeed offer me a pleasnat stay,which helps me better understand the American culture.It was so nice of you to meet me at the airport,arrange accommodation for me and show me around.The program is one of the most wonderful memories in my life.Beside,It is also a good honor to make friend with you.
I am looking forward to your visit to China,so that I will be able to do the honors and pay back your kindness I have received.
I feel abliged to thank you again.

Yours Sincerely
Li Ming

2011仿写

Dear Li Ming,
Congratulations!As your cousin,I’m delighted to hear that you have been admitted to Stanford University.I really feel proud of you.I know the competition this year was intense and your hard work and perseverance finally paid off.
University life is totally different from that your high school.Accordingly,I’d like to give you several practical suggestions on how to prepare for university life.Firstly,you should get psychologically prepared for the approaching independent life.It will be your first time to live away from home.Secondly,I hope you could take advantage of the libraray at your university by reading books.Last but not least,It is advisable that you be engaged in the following three activities in your free time:exercise,relaxation,and communication with friends and family.
University life is a unique season in the life of any students.I wish you further success in your college studies and hope you will enjoy it.

Yours Sincerely
Li Ming

3012年仿写

As a regular customer of your company, I was completely disappointed to find that the service you provided was far from satisfactory.I bought an electronic dictionary from your online store ten days ago.I found something wrong with it after using a short period of time.
The electronic dictionary worked well at first.However I regret to tell you that only three days after the

申请信(学生贷款)

Dear Sir or Madam,
I am a third-year student majoring in history at Peking University.I’m writing to seek your assistance to finance my fourth year’s course.
In the fourth year,studying will be my priority and I will have to cut back on my part-time jobs off campus.That is why I seek your help through a student loan.
I am still not clear about the conditions for applying for a student loan.Could you please send me the details about repayments,lending rates and duration?Many thanks for considering my request.

Yours Sincerely
Li Ming

邀请信

Dear Professor Bokenkamp,
I am very pleased to inform you that Peking University is organizing an academic conference entitled “Sino-US Conference on Philosophy and Religious Studies” on December 8-9 in Beijing.
You are cordially invited to participate in this important Chinese academic event as our guest speaker.You will be welcome to participate fully in the activities of the conference,including workshops,seminars,and recreational activities.Your round-trip air ticket,accommodation and meal expenses will be subsidized.
We look forward to seeing you at this conference and to having you as significant part of this event.If you accept this invitation,please advise us of your date of arrival,so that we can make necessary arrangements.

Yours Sincerely
Li Ming

祝贺信

Dear Wuji,
Congratulations upon your receiving your doctorate in philosophy from Yale University.I know this meant years of study and hard work on your part.It is an achievement you may well be proud of.
I have followed your progress with pleasure and interest for many years.

大作文

饼图+青年创业
From the pie chart, we can see the reasons why college students start their own business in a certain university.Those whose ideas are to become entrepreneurs account for 44% of the total,highest among all the five categories.While those who could not find suitable jobs and thus turn to running their own business account for 15%.
It is not uncommon for college students to start their own business prior to or after graduation.Above all,students who start their own businesses can gain a better insight into their future career.In addition,no matter whether a college student succeeds or fails to starting his or her business,the work experience gained will come in handy when he or she seeks a fulltime job after graduation.Employers will regard these graduates as more hard-working and motivated than those who lack work experience.Although running a new business is a valuable learning experience and skill builder,it is vital that college students should give priority to their studies.
In my opinion,college students should know how to make good use of their time outside of class.Indeed,many students don’t deal with the real world until they have to.However,starting a business that is related to a college student’s major is beneficial.

柱状图+电子游戏
The chart reveals the market size of web games in China from the first quarter of 2010 to the second quarter of 2011.There has been a jump in market size from 520 million yuan in the first quarter of 2010 to 700 million yuan in the first quarter of 2011, a rise of 260 million yuan,at a year-on-year growh rate of 50%.
This obviously shows the popularity of computer gaming in China.We are not told the ages of those who game or how long they spend doing it each day or week,but we can assume that web games are growing in popularity and that more time is spent on playing them.
From the chart we can predict that web games will continue to do well in the future.However,it should be stressed that people playing computer games should behave in a responsible way and that a balance should be stuck so that studies,work and family and friends are not adversely affected by overindulgence in games.

Being indulged in computer games affects children’s studies and their interaction with others.

柱状图+工程硕士招生
The diagram above clearly illustrates that there was a dramatic increase in Master of Engineering admissions across the country from 1998 to 2004.In 1998,the number was only about 2500,and it reached morethan 35000 in 2004.
Some factors that contribute to the above-mentioned change may be summarized as follows.First and foremost,China’s booming manufacturing industry needs more and more qualified engineers.In addition,the development fo the job market on the whole cannot keep pace with the expansion in college graduate numbers,which obliges a large number of students to stay on campus for another two or three years to get better prepared for their career.Taking the two factors into account,we may predict that with the speedy development of our society.M.E. admissions will keep growing in the forthcoming decade.
The growing demand for more practical degrees such as M.E.s and the burgeoning manufacturing industry have led to a surge of graduates in these areas which augurs well for the economy.

柱状图+读书
The column chart above reveals clearly the statistics of the average numbers of books read in seven coutries in 2013.Based upon the data,we can see that people from the U.S,Israel and Russia read the largest amounts of books among the seven countries.The average numbers are 56,44 and 42 respectively.In comparison,the average numbers are merely 11 and 4 in Korea and China,the smallest numbers among 7 countries.
This tendency is rather disturbing,for one should konw that reading extensively is no less necessary to one’s mental life than fresh air to one’s physical life.From reading extensively,we can derive pleasure,experience and instruction.First and foremost,a good book is our faithful friend.

未命名

发表于 2019-12-07

12.6

https://youtu.be/LymBsHl5XlY

12.7

https://youtu.be/PJp2Kqptedc
https://youtu.be/a0acdxJUB1M
https://youtu.be/yp76v_NMXXM

12.7

/etc/init.d/shadowsocks stop

google验证地址:
https://www.youtube.com/verify_phone_number?next_url=%2Ffeatures
居然可以用虚拟手机的语音

btsnns@gmail.com
乘风破浪
https://www.youtube.com/channel/UCtdgSENKDJMPYzCUTd3YwSQ?view_as=subscriber
bit.ly/33Th2oB

老子他妈一定会赢!
https://www.youtube.com/channel/UCIZ31EXXHiEdTIAp2di5HRw?view_as=subscriber
bit.ly/34ZjDi7

数据结构

发表于 2019-11-27

序言

  1. 数据结构是一门研究非数值性程序设计中计算机操作的对象以及它们之间的关系和操作的学科。
    算法好坏的区分标准:
    运行速度(时间),所占空间,精确度等.
  2. 数据(data)
    描述客观事物的数,字符,以及所有能输入计算机的,并被计算机程序识别和处理的符号集合.或者说数据是计算机化的信息.
  3. 数据结构(data structure)
    由某一数据对象及该对象中所有数据成员之间的关系组成,记为:
    Data_Structure={D,R} 
    D是某一数据对象,R是该对象中所有数据成员之间的关系的有限集合.
    数据的逻辑结构—–从用户视图看是面向问题的.
    数据的物理结构—–从具体实现视图看,是面向计算机的.(顺序,拉链)
  4. 抽象数据类型(ADTs: Abstract Data Types)
    抽象:是一种信息隐蔽的方法.
    抽象数据类型:提供组织和设计程序的一种新方法.
    思想:将数据类型的使用与它的内部表示(机内存储),实现(机内操作的实现)分开.更确切地说:把一个数据类型的内部表示及在这个类型上的操作实现封装到一个程序模块中,用户不必知道细节.
    抽象数据类型的特征是使用和实现分离,实行封装 和信息隐蔽
    优点:
    从使用者来看,只要了解该抽象数据类型的规格说明,就可以利用其公共界面中的服务来使用这个类型,而不必关心其物理实现.
    从实现者的角度看:把抽象数据类型的物理实现封装起来,有利于编码、测试,也有利于扩充、修改.
  5. 面向对象的概念
    面向对象=对象+类+继承+通信
    面向对象=对象+类+继承+通信
    对象:
    指各种实体,事件,规格说明,由一组属性值(确定对象的状态)和在这组值上的一组操作构成.
    例如:定义一个矩形对象:
    属性:左上角坐标, 右下角坐标, 边线颜色, 内部颜色.
    操作:move(x,y); SetEdgeColor(c); SetInnerColor(c);
    类:具有相同属性和操作的对象构成同一个类.
    对类而言,其中的每一个对象称为该类的一个实
    例(instance),不同的实例具有不同的属性值.
  6. 把n个整数用选择排序的方法由小到大排列.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    void SelectSort(int a[], const int n)
    { for (int i=0; i<n-1; i++)
    {
     int k = i; //k中存放每趟比较最小元素的下标
     for (int j=i+1; j<n; j ++)
    if (a[j] < a[k]) k = j;
     int temp=a[i]; a[i]=a[k]; a[k]=temp;
    }
    }
  7. 性能分析与度量
    1)算法的性能标准
     ①.正确性  ②.可使用性  ③.可读性
     ④.效率  时间代价(主要讨论的)
           空间代价
    2)时间复杂度度量
     ⑴.程序步(program step)
     是指在语法上或语义上有意义的一段指令序列.

链表

编程题

求数组a的最大值

1
2
3
4
5
6
7
8
9
int max(int a[], int n) {
if (n == 1) return a[0];
int m = max(a, n - 1);
if (m > a[n - 1]) {
return m;
} else {
return a[n - 1];
}
}

求数组a的平均值

1
2
3
4
5
6
7
8
9
10
11
12
float average(int a[], int n) {
if (n == 1) {
return a[0];
} else {
return (average(a, n - 1) * (n - 1) + a[n - 1]) / n;
}
}

float average(ListNode f, int n) {
if (f.link == NULL) return false;
else return (average(f.link, n - 1) * (n - 1) + f.data) / n;
}

统计叶子结点个数

1
2
3
4
5
6
7
int leafNum(BinTreeNode <Type> * root) {
if (root == NULL) return 0;
if (root->leftChild == NULL && root->rightChild == NULL) return 1;
else {
return leafNum(root->leftChild) + leafNum(root->rightChild);
}
}

交换左右子数

1
2
3
4
5
6
7
8
void swapChild(BinTreeNode * p) {
if (p == NULL) return;
BinTreeNode *temp = p->left;
p->left = p->right;
p->right = temp;
swapChild(p->left);
swapChild(p->right);
}

如果用链表来实现表求链表中的最大值

1
2
3
4
5
6
7
8
int getMaxNum(ListNode f) {
if (f.link == NULL) return f.data;
else [
int i = getMaxNum(f.link);
if (i > f.data) return i;
else return f.data;
]
}

逆转链表

1
2
3
4
5
6
7
8
9
10
11
12
void inverse(ListNode f) {
if (f == NULL) return;
ListNode p = f.link;
ListNode pr = NULL;
while (p != NULL) {
f.link = pr;
pr = f;
f = p;
p = p.link;
}
f.link = pr;
}

作业

编写一个递归方法,它返回数N的二进制表示中1的个数。

1
2
3
4
5
6
7
public static int count(int n) {
if (n == 0) {
return 0;
} else {
return n % 2 + count(n / 2);
}
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public void permute(char[] str, int low, int high) {
if (low == high) { // low = 0, high = str.lengh
System.out.println(str);
} else {
for (int i = low; i <= high; i++) {
char temp;
temp = str[i];
str[i] = str[low];
str[low] = temp;
permute(str, low + 1, high);
temp = str[i];
str[i] = str[low];
str[low] = temp;
}
}
}

求数组A中的最大整数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public int max(int[] num, int n) {
if (n == 1) return num[0];
else {
int temp = max(num, n - 1);
if (temp > num[n - 1]) {
return temp;
} else {
return num[n - 1];
}
}
}

public int max_(int[] num, int left, int right) {
if (left == right) {
return num[left];
} else {
int x = max_(num, left, (left + right) / 2);
int y = max_(num, (left + right) / 2 + 1, right);
return (x > y) ? x : y;
}
}

// low = 0, n = hight = num.length;

求n个整数的平均值

1
2
3
4
5
6
7
double average(int[] num, int n) {
if (n == 1) {
return (double)num[0];
} else {
return (double)(average(num, n - 1) * (n - 1) + num[n - 1]) / n;
}
}

递归求解链表的长度

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public class Length {
public static int length = 0;
public static int GetLength(Iterator it) {
if (!it.hasNext()) {
return 0;
} else {
it.next();
return 1 + GetLength(it);
}
}
}

public int caculate(ListNode p) {
if (p == null) return 0;
else return 1 + caculate(p.nest);
}

class ListNode {
Object content = null;
ListNode nest = null;
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public boolean palinedromes(String word) {
if (word == null) return false;
else if (word.length() <= 1) return true;
else if (word.charAt(0) == word.charAt(word.length() - 1)) {
return palinedromes(word.substring(1, word.length() - 1));
}
else return false;
}

public boolean sentence(String sentence) {
String one = sentence.toLowerCase();
String two = "";
for (int i = 0; i < sentence.length(); i++) {
if (one.charAt(i) >= 'a' && one.charAt(i) <= 'z') {
two += one.charAt(i);
}
}
return palinedromes(two);
}

求下面函数的复杂度,这个函数是用来在一个未排序的整数数组中查找第k个整数的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// 从一个数组里找到第K小的数
// k次,每次都找第i小的数,找到后,放到i位
int selectKth(int a[], int k, int n) {
int i, j, mini, temp;
for (i = 0; i < k; i++) {
mini = i; // 1
for (j = i + 1; j < n; j++) {
if (a[j] < a[mini]); // 1
mini = j; // 1
}
temp = a[i]; // 1
a[i] = a[mini]; // 1
a[mini] = temp; // 1
}
return a[k - 1];
}


sum++被执行的次数

1
2
3
4
5
sum=0;
for(i=0; i<n; i++)
for(j=0; j<i*i; j++)
for(k=0; k<j; k++)
sum++;


i的从0到n-1,因为当i为0时候,内层循环并不会被执行,所以是n-1次
j是从0到ii-1,也就是ii次
k是从0到j-1。
来看一次内层循环,当i=1,j是从0,k取0,0次
当i=2,j从0到3,j=0,k 0 0次,j = 1,k0 1次,j=2,k01二次,j=3,k012三次
j从0到ii-1用ii项,而内层循环是从0到i*i-1次 用等差数列求和可得以上公式

1
2
3
4
5
6
sum=0;
for(i=0; i<n; i++)
for(j=0; j<i*i; j++)
if(j%i==0) //注意
for(k=0; k<j; k++)
sum++;

分析(了解%运算符)
运行时间f(n)取决于sum++的执行次数,
sum++只在j=i、2i、3i、…(i-1)i时才会执行

1
2
3
4
5
6
7
8
设n为正整数,分析下列各程序段中加下划线的语句的执行次数。
1)
for (int i = 1; i <= n; i++)
for (int j = 1; j<=n; j++){
c[i][j] = 0.0;
for ( int k = 1; k <= n; k++)
c[i][j] = c[i][j]+a[i][k]*b[k][j];
}

1
2
3
4
5
x = 0; y = 0;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= i; j++)
for (int k = 1; k <= j; k++)
x = x+y;


是k(k+1),i从i到n的一半。n个1到i的等差数列和。

负数放在非负数前

1
2
int[] num = new int[10];
int len = num.length;
1
int n[ 10 ];
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public void sort(int[] num) {
int len = num.length;
int temp, i = 0, j = len - 1;
while (i != j) {
if (i < len && num[i] < 0) {
i++;
}
if (j >= 0 && num[j] >= 0) {
j--;
}
temp = num[i];
num[i] = num[j];
num[j] = temp;
}
}

循环数组实现循环队列 c++

假设以数组Q[m]存放循环队列中的元素,同时以rear和length 分别指示环形队列中的队尾位置和队列中所含元素的个数:
1)求队列中第一个元素的实际位置。
2)给出该循环队列的队空条件和队满条件,并写出相应的插入(enqueue)和删除(dlqueue)元素的操作算法。

1
2
3
4
front=rear-length+1
front=rear+m-length+1

front=(rear-length+1+m)%m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// 队空条件
public boolean isEmpty() {return length==0;}
public boolean isFull() {return length==m;}
//入队函数
public void enqueue(Object x) throw Overflow {
if (isFull())
throw new Overflow();

length++;
rear = (rear+1)%m;
Q[rear] = x;
}
//出队函数
public Object dequeue() throw Underflow {
if (isEmpty())
throws new Underflow();

length--;
return Q[(rear-length+m)%m];
}


## 不带表头的链表求平均值递归
```java
public class ListNode {
int data;
ListNode link;
ListNode(int x) { data = x; }
}
public float average(ListNode f, int n) {
if (f.link == null) return f.data;
else {
return (average(f.link, n - 1) * (n - 1) + f.data) / n;
}
}

输出不小于k

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public class BinaryNode {
int data;
BinaryNode left;
BinaryNode right;
}

public class BST {
private BSTNode root;
public BST() {
this.root = null;
}
}

public void BSTfind(BSTNode root, int k) {
if (root == null) return;
BSTfind(root.right, k);
if(root.data >= k) {
System.out.println(root.data);
}
BSTfind(root.left, k);
}

最小堆调整

1
2
3
4
5
6
7
8
9
10
11
12
13
14
private void pereUp(Comparable[] a, int start) {
int j = start;
int i = j / 2;
Comparable temp = a[j];
while (j > 1) {
if (a[i] <= temp) break;
else {
a[j] = a[i];
j = i;
i = i / 2;
}
}
a[j] = temp;
}

名词解释

二叉搜索树
它或者是一棵空树,或者是具有下列性质的二叉树: 若它的左子树不空,则左子树上所有结点的值均小于它的根结点的值; 若它的右子树不空,则右子树上所有结点的值均大于它的根结点的值; 它的左、右子树也分别为二叉排序树。
图的最小生成树
堆
堆中某个节点的值总是不大于或不小于其父节点的值;
堆总是一棵完全二叉树。

线性结构
一个数据元素的有序集合
算法的时间复杂度
法在编写成可执行程序后,对运行时所需要的时间资源的度量。
散列表的线性探查法

快速排序的最坏时间浮渣度
“在哈夫曼树(也叫最优树)中,只有两种类型的结点:度为0或N,即最优二叉树中只有度为0或2的结点,最优三叉树中只有度为0或3的结点,所以有2N-1个节点 。”
用最小堆排序

5阶B树 添加删除
Dijkstra方法计算1到其他顶点的最短路劲

key

二、
//策略接口
public interface Description {
public String getDescription(String applicatioName, float avarageRate, ArrayList newFeatureItems);
}
//实现策略
public class DescriptionForAndroid implements Description{
public String getDescription(String applicatioName, float avarageRate, ArrayList newFeatureItems) {
StringBuffer result = new StringBuffer();
result.append(“This is “+ applicatioName + “ for Android platform\n”);
for(int i =0; i< newFeatureItems.size(); i++) {
result.append(newFeatureItems.get(i).getDescription());
}
result.append(“Avarage Rate from Google Play\n”);
result.append(String.valueOf(avarageRate));
return result.toString();
}
}
public class DescriptionForiOS implements Description{
public String getDescription(String applicatioName, float avarageRate, ArrayList newFeatureItems) {
StringBuffer result = new StringBuffer();
result.append(“This is “+ applicatioName + “ for iOS platform\n”);
for(int i =0; i< newFeatureItems.size(); i++) {
result.append(newFeatureItems.get(i).getDescription());
}
result.append(“Avarage Rate from App Store\n”);
result.append(String.valueOf(avarageRate));
return result.toString();
}

}
//context
class Application {
prative String applicatioName;
prative float avarageRate;
prative ArrayList newFeatureItems = new ArrayList();
Description description;
void setDescription(Description description) {
this.description = description;
}
String getDescription() {
return description.getDescription();
}

}

三

答:

违反了迪米特法则
public class Customer {
Rental rental;
int getNewRentPoint(){
return rental.getNewRentPoint();
}
}
public class Rental {
private int daysRented;
private Movie movieRented;
public int getDaysRented(){
return daysRented;
}
public Movie getMovieRented(){
return movieRented;
}
public Movie getNewRentPoint(){
if((movieRented.getPriceCode() == Movie.NEW_RELEASE) && daysRented > 1) {
return 2;
}
else
return 1;
}
}
public class Movie {
private int priceCode;
public static final int CHILDRENS = 2;
public static final int REGULAR = 0;
public static final int NEW_RELEASE = 1;
public int getPriceCode(){
return priceCode;
}
}


四

答

1) 第一段程序违反了里氏替换原则。第二段程序设计合理,因为能用Person的地方也能用Employee替代。
2) 里氏替换:子类型必须能够替换掉基类型而起相同的作用。
public class MyStack extends Vector {
Vector v = new Vector();
public void push(Object element) {
v.insertElementAt(element,0);
}
public Object pop() {
Object result = v.firstElement();
v.removeElementAt(0);
return result;
}
}


五

答案

1) 数据耦合,不用修改。
2) 控制耦合,改为1) 的形式。


六

答案

1)
2) 性能需求、质量属性、对外接口、约束。


七

答案


八

答案

1.用户输入错误的信息,系统会标注出来,而不是叫用户重写整段代码。体现了人机交互的低出错率设计。
2.使用逐层递进的方式展示信息、并且小功能使用直截了当的图像快捷方式。体现了人机交互的易记性设计。
3.编不出来了。。。


九

答

这题感觉是用策略模式来定义各个挡位的税收,然后定义一个工厂来根据实际的taxable_income,来返回相应的策略对象。

计算机网路

发表于 2019-11-27

第1章:计算机网络及其参考模型

  1. What is a network ?
    A network is an intricately connected system of objects, devices, or people.

  2. Companies created networks
    As companies expanded,the need for connecting networks at different sites became very important.

  3. Data Networks Classifications
    LAN( Local Area Networks )

  1. Internet

#
IGRP 内部网关路由协议(英语:Interior Gateway Routing Protocol,缩写为IGRP)
OSPF OSPF(Open Shortest Path First开放式最短路径优先)是一个内部网关协议

“ip地址根据网络规模可以分为,A类,B类,C类,D类和E类。其中A、B、C是基本类,D、E类作为多播和保留使用。IP地址类型 :A类从1.0.0.0/8到126.0.0.0/8;B类从128.0.0.0/16到191.255.0.0/16;C类从192.0.0.0/24到223.255.255.0/”

LAN( Local Area Networks )
WAN( Wide Area Networks )

时分复用TDM
时分复用是将时间划分为一段段等长的时分复用(TDM )帧,
每个时分复用的用户在每个 TDM 帧中占用固定序号的时隙.

频分复用 FDM
用户在分配到一定的频带后,在通信过程中自始至终都占
用这个频带.

LLC
逻辑链路控制

ICMP
ICMP(Internet Control Message Protocol)Internet控制报文协议

RIP
RIP(Routing Information Protocol,路由信息协议)

full duplex
全双工

OSI REFERENCE MODEL
开放式系统互联通信参考模型(英语:Open System Interconnection Reference Model,缩写为 OSI)

DHCP(动态主机配置协议)是一个局域网的网络协议。

Domain Name System
域名系统(服务)协议

split horizon
水平分割(split horizon)是一种避免路由环路的出现和加快路由汇聚的技术。

TDM
时分复用TDM是采用同一物理连接的不同时段来传输不同的信号

RARP
反向地址转换协议(RARP:Reverse Address Resolution Protocol)

软件工程

发表于 2019-11-27

软件工程基础

  1. 软件工程:
    应用系统的,规范的,可量化的方法来开发,运行和维护软件,即将工程应用到软件。
    对1中各种方法的研究。

关键是子类扩展父类的时候,只能增加字段和方法,而不能增加约束。

长和宽必须相等是对父类中两个字段的约束,而在子类无法扩展这种约束,这算是目前oo语言的局限性。期待下一代oo语言解决。

“能够施行于base class对象上的每件事情,也可以施行于derived class对象身上”


这个就是“里氏替换原则”。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class Rectangle{
private double width;
private double height;

public void setWidth(double width) {
this.width = width;
}

public double getWidth() {
return width;
}

public void setHeight(double height) {
this.height = height;
}

public double getHeight() {
return height;
}

public double getPerimeter(){
return (width + height) * 2;
}

public double getArea(){
return width * height;
}
}

class Square extends Rectangle {

@Override
public void setWidth(double width) {
super.setWidth(width);
super.setHeight(width);
}

@Override
public void setHeight(double height) {
setWidth(height);
}
}

https://www.jianshu.com/p/eeefa13d6dbe

耦合度举例说明

内容耦合。当一个模块直接修改或操作另一个模块的数据时,或一个模块不通过正常入口而转入另一个模块时,这样的耦合被称为内容耦合。内容耦合是最高程度的耦合,应该避免使用之。

1
2
3
4
5
6
7
8
9
class A{
    public int data_a;
}
class B{
    public fun(){
        A a = new A();
        a.data_a = 5;
    }
}

这里B直接修改了A的data_a,所有是“内容耦合”;

公共耦合。两个或两个以上的模块共同引用一个全局数据项,这种耦合被称为公共耦合。在具有大量公共耦合的结构中,确定究竟是哪个模块给全局变量赋了一个特定的值是十分困难的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class C{
    int static data_x;
    int static data_y;
}

class A{
    public void fun(){
        C.data_x = 5;
    }
}
class B{
    public void fun(){
        C.data_x = 6;
    }
}

A和B都可以操作data_x,说以A和B是“公共耦合”

外部耦合 。一组模块都访问同一全局简单变量而不是同一全局数据结构,而且不是通过参数表传递该全局变量的信息,则称之为外部耦合。

1
2
3
4
5
6
7
8
9
10
11
int static data_x;
class A{
    public void fun(){
        data_x = 5;
    }
}
class B{
    public void fun(){
        data_x = 6;
    }
}

A和B都访问data_x,所以A和B是外部耦合。

控制耦合。一个模块通过接口向另一个模块传递一个控制信号,接受信号的模块根据信号值而进行适当的动作,这种耦合被称为控制耦合。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class A{
    private B mB;
    private int m_a= 4;
    public void update(){
        m_a= mB.get();
    }
}
class B{
    A mA;
    int m_b;
    public void fun(){
        data_x = 6;
    }
    public void set(int b){
        this.m_b =b;
        mA.update();
    }
}

当B.set()运行时,A的m_a也会从新设计,说以A和B是“控制耦合”

标记耦合。若一个模块A通过接口向两个模块B和C传递一个公共参数,那么称模块B和C之间存在一个标记耦合。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class B{
    stiac void fun(int a){
    }
}
class C{
    static void fun(int a){
    }
}
class A{
    int m_a = 5;
    void fun(){
        B.fun(m_a );
        C.fun(m_a );
    }
}

A向B和C传递了共同的参数m_a ,所有B和C是标记耦合

数据耦合。模块之间通过参数来传递数据,那么被称为数据耦合。数据耦合是最低的一种耦合形式,系统中一般都存在这种类型的耦合,因为为了完成一些有意义的功能,往往需要将某些模块的输出数据作为另一些模块的输入数据。

1
2
3
4
5
6
7
8
9
class A{
void fun(int a);
}
class B{
void fun(A a){
int b;
a.fun(b);
}
}

模块A和B通过参数传递数据,所有A和B是“数据耦合”

非直接耦合 。两个模块之间没有直接关系,它们之间的联系完全是通过主模块的控制和调用来实现的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class A{
    int fun(){
    }
}
class B{
    void fun(int a){
    }
}
class Client{
    void main(){
        A a = new A();
        B b = new B();
        int i_a = a.fun();
        b.fun(i_a);
    }
}

A和B没有直接连接,他们的调动是通过Client来完成,说以A和B是“非直接耦合”

多项式加法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
//定义节点类
class Node{
public int coef;//系数
public int exp;//指数
public Node next=null;//下个节点
public Node(){
coef=0;
exp=0;
}
public Node(int coef,int exp){
this.coef=coef;
this.exp=exp;
}
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//多项式类
public class PolynList {
//多项式相加
public Node add(Node link1, Node link2) {
Node pre=link1;
Node qre=link2;
Node p=pre.next;
Node q=qre.next;
Node result=p;
while(p!=null && q!=null){
if(p.exp<q.exp){
pre=p;
p=p.next;
}else if(p.exp>q.exp){
Node temp=q.next;
pre.next=q;
q.next=p;
q=temp;
}else{
p.coef=p.coef+q.coef;
if(p.coef==0){
pre.next=p.next;
p=pre.next;
}else{
pre=p;
p=p.next;
}
qre.next=q.next;
q=qre.next;
}
}
if(q!=null){
pre.next=q;
}
return result;
}

//添加数据方法
public Node insert(Node link,int coef,int exp) {//添加节点
Node node=new Node(coef,exp);
if(link==null){
link.next=node;
}else{
Node temp=link;
while(temp.next!=null){
temp=temp.next;
}
temp.next=node;
}
return link;
}
}
//主方法
public static void main(String[] args) {
PolynList ts = new PolynList();
Node link1=new Node();
Node link2=new Node();
//第一个多项式
ts.insert(link1,4,0);
ts.insert(link1,5,2);
ts.insert(link1,4,8);
ts.insert(link1,6,12);
//第二个多项式
ts.insert(link2,6,1);
ts.insert(link2,6,3);
ts.insert(link2,3,8);
ts.insert(link2,4,15);
ts.insert(link2,8,20);

link1 = ts.add(link1, link2);

while(link1!=null){
if(link1.exp== 0)
System.out.print(link1.coef);
else
System.out.print(link1.coef+"x^"+link1.exp);
link1=link1.next;
if(link1!=null)
System.out.print("+");
}
}
}

栈(stack)
1).定义:插入和删除只能在表的一端进行的线性表.
     又称后进先出(LIFO--Last In First Out)
例子:饭店里的一堆碟子

队列(queue)
1) 定义:插入在一端进行,删除在另一端进行的线性
表.又称先进先出(FIFO:First In First Out)

递归的概念
若一个对象部分地包含它自己或用它自己给自己定义,则称这个对象是递归的。
若一个过程直接地或间接地调用自己,则称这个过程是递归的过程。

1
2
3
4
long factorial(long n)
{ if(n==0)return 1;//递归终结条件
else return n*factorial(n-1);//n问题化为n-1问题
}

12…8

REQg

78 日志
4 分类
22 标签
© 2020 REQg
由 Hexo 强力驱动
|
主题 — NexT.Mist v5.1.4
浙ICP备 - 19004121号