`
yangliuy
  • 浏览: 66166 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论
文章列表
这是我面试一个公司的时候碰到的面试题 Q请用两个栈模拟实现队列,至少完成入队、出队及计算长度的方法 A 基本思路是两次后进先出 = 先进先出,元素入队列总是入左栈,元素出队列如果右栈不为空直接弹出右栈头元素;如果右栈为空就把左栈元素出栈全部压入右栈,再弹出右栈头,这样就模拟出了一个队列。 Class Q{ stack<int> S1,S2; void push(int a){ S1.push(a); } int pop(){ if(S2.empty()){ while(S1.size()>0){ S2.push(S1. ...
基本思路就是求逆序数然后根据逆序数排序,出现的问题有: 1、这题出现的问题主要是对m和n总是搞混,而且提交出现了Runtime Error,这个错误一般都是由于一般都是非法访问内存(数组越界、访问空指针、堆栈溢出)、做除法时除以了0 等造成的,后来仔细看了一下“a positive integer n (0 < n <= 50) giving the length of the strings; and a positive integer m (0 < m <= 100) giving the number of strings. ”就立刻发现了错误,结构体数组开 ...
POJ 1040 Transportation Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 2872 Accepted: 1176 Description Ruratania is just entering capitalism and is establishingnew enterprising activities in many fields in- cluding transport. Thetransportation ...
TOPIC: ARGUMENT241 - The following appeared in a memo at the XYZ Company. "When XYZ lies off employees, it pays Delany Personnel Firm to offer those employees assistance in creating résumés and developing interviewing skills, if they so desire. Laid-off employees have benefited greatly from De ...
TOPIC: ISSUE88 - "Technologies not only influence but actually determine social customs and ethics." WORDS: 455 TIME: 01:00:00 DATE: 2011-4-16 0:30:51 The development of technologies is a main power that pushes the improvement of the society. Does technologies not only influence but act ...
TOPIC: ARGUMENT37 - Woven baskets characterized by a particular distinctive pattern have previously been found only in the immediate vicinity of the prehistoric village of Palean and therefore were believed to have been unique to the Palean people. Recently, however, archaeologists discovered such a ...
TOPIC: ISSUE17 - "There are two types of laws: just and unjust. Every individual in a society has a responsibility to obey just laws and, even more importantly, to disobey and resist unjust laws." WORDS: 528 TIME: 01:00:00 DATE: 2011-4-11 23:09:15 Does every individual in a society has ...
TOPIC: ARGUMENT76 - The following appeared as part of an article in a health and beauty magazine. "A group of volunteers participated in a study of consumer responses to the new Luxess face cream. Every morning for a month, they washed their faces with mild soap and then applied Luxess. At th ...
TOPIC: ISSUE144 - "It is the artist, not the critic,* who gives society something of lasting value." *a person who evaluates works of art, such as novels, films, music, paintings, etc. WORDS: 496 TIME: 01:00:00 DATE: 2011-4-10 23:13:30 The speaker asserts that it is the arts rather ...
TOPIC: ARGUMENT209 - The following recommendation was made by the Human Resources Manager to the board of directors of the Fancy Toy Company. "In the last three quarters of this year, under the leadership of our president, Pat Salvo, our profits have fallen considerably. Thus, we should ask f ...
TOPIC: ISSUE153 - "Students should bring certain skepticism to whatever they study. They should question what they are taught instead of accepting it passively." WORDS: 488 TIME: 01:00:00 DATE: 2011-4-10 15:56:03 Should students bring a certain skepticism to whatever they study, as this ...
TOPIC: ARGUMENT7 - The following appeared in a letter to the editor of the Clearview newspaper. "In the next mayoral election, residents of Clearview should vote for Ann Green, who is a member of the Good Earth Coalition, rather than for Frank Braun, a member of the Clearview town council, b ...
TOPIC: ISSUE69 - "Government should place few, if any, restrictions on scientific research and development" WORDS: 482 TIME: 01:00:00 DATE: 2011-4-10 0:19:42 Should government place few restrictions on scientific research and development, as the statement suggests? In response to this i ...
TOPIC: ARGUMENT53 - Thirteen years ago, researchers studied a group of 25 infants who showed signs of mild distress when exposed to unfamiliar stimuli such as an unusual odor or a tape recording of an unknown voice. They discovered that these infants were more likely than other infants to have been c ...
TOPIC: ISSUE208 - "The way people look, dress, and act reveals their attitudes and interests. You can tell much about a society's ideas and values by observing the appearance and behavior of its people." WORDS: 461 TIME: 01:00:00 DATE: 2011-4-9 18:00:29 Do the way people look, dress and ...
Global site tag (gtag.js) - Google Analytics