S*A 发帖数: 7142 | 1
你自己跑过你这样的测量程序吗,肯定没有吧。我随便看一眼你这段修改过
嵌入汇编就有至少2处影响结果的错误。要不你先改好了先测一下吧。
这个就留给你做功课了。
关于 out of order, 你知道 Intel 内部是翻译成完全不同的 micro code
执行的吧?连 register 都是 remap 过的。 所以你说绝对不会产生 1000
clocks 级别的误差从那里来的,有 Intel 官方的出处吗?
我只是很奇怪你为什么不先修正了你的程序再讨论。
[ssa]$ sudo ./a.out 1 0
allocate mem@0xbb6010
memory lock is enabled.
Please run "sudo chrt -f -p [priority] " to change scheduling policy,
then press any key to continue.
Num of buffers: 1, size of each buffer: 256*8=2048 bytes, repeat 1 times,
testing.....
work... 阅读全帖 |
|
x**l 发帖数: 64 | 2 谢谢你指出错误,匆忙之中修改的,没有测试.
如果你的CPU不支持 rdtscp,请使用这个function
typedef unsigned long long ticks;
static __inline__ ticks getticks(void)
{
unsigned a, d;
asm volatile(
"rdtsc;"
: "=a" (a), "=d" (d)
:
: "memory");
asm volatile("cpuid"
:
:
: "%eax", "%ebx", "%ecx", "%edx");
return ((ticks)a) | (((ticks)d) << 32);
}
你没有用numactl去调用,所以即使修改了代码,结果也不准确。
这是我的sample 输出
$ sudo numactl --physcpubind=3 --membind=0 ./a_i... 阅读全帖 |
|
m**v 发帖数: 373 | 3 这里是一个完整的call的信息,对方挂电话就直接segmentation fault了。log里面没有
任何信息。
*CLI> -- Executing [D***[email protected]@google-in:1] GotoIf("Gtalk/+XXX-152d
", "0?bridged") in new stack
-- Executing [D***[email protected]@google-in:2] NoOp("Gtalk/+XXX-152d", "Call
erid +**[email protected]/srvres-MTAuMjIwLjIwNC4yMTo5ODQw") in new stack
-- Executing [D***[email protected]@google-in:3] Set("Gtalk/+XXX-152d", "CALLE
RID(num)=+XXX") in new stack
-- Executing [D***[email protected]@google-in:4] Set("Gtalk/+XXX-152d", "CALLE
R... 阅读全帖 |
|
h**z 发帖数: 9751 | 4 结构安全高下立见阿,但golf气囊展开位置的保护有点不太好。
马自达
Structure
The driver space was maintained well, with maximum intrusion of the lower
interior of 12 cm at the lower hinge pillar. Upper interior intrusion
measured 7-9 cm at the instrument panel.
Injury measures
Measures from the dummy indicate that injuries to the right lower leg would
be possible in a crash of this severity. The risk of significant injuries to
other body regions is low.
Injury measures
Measures from the dummy indicate that injuries to the righ... 阅读全帖 |
|
P*****J 发帖数: 1745 | 5 嗯,试试ball and dummy drill,看看你用实弹击发的时候和dry fire的时候动作一致
不一致。如果你发现在ball and dummy drill里你击发的动作也很好,击锤落下后枪纹
丝不动,那就真是枪的问题了。
http://pistol-training.com/drills/ball-dummy-drill
Ball & Dummy Drill
Range: 3yd
Target: small (3×5 card, 3″ dot)
Start position: any
Rounds fired: varies
This drill has been used for decades to help shooters overcome problems
anticipating recoil and jerking the trigger. It’s a staple of every
instructor’s diagnostic toolbox.
You will need some snap caps or dummy rounds to do this... 阅读全帖 |
|
P*****J 发帖数: 1745 | 6 嗯,试试ball and dummy drill,看看你用实弹击发的时候和dry fire的时候动作一致
不一致。如果你发现在ball and dummy drill里你击发的动作也很好,击锤落下后枪纹
丝不动,那就真是枪的问题了。
http://pistol-training.com/drills/ball-dummy-drill
Ball & Dummy Drill
Range: 3yd
Target: small (3×5 card, 3″ dot)
Start position: any
Rounds fired: varies
This drill has been used for decades to help shooters overcome problems
anticipating recoil and jerking the trigger. It’s a staple of every
instructor’s diagnostic toolbox.
You will need some snap caps or dummy rounds to do this... 阅读全帖 |
|
t*******r 发帖数: 22634 | 7 看了,是按作者分的。
其实按作者分一般属于高级类,师从华山派还是嵩山派。。。
其实版务也很忙,真要分初级中级高级,也没时间整理。俺的建议
就是加上 for dummies 就好。高级的,其实个人自己也是会去
搜索的。比如这么分:
(1)For dummies:
唱歌 for dummies:
护嗓 for dummies:
伴奏 for dummies:
器材 for dummies:
录音 for dummies:
软件 for dummies:
后期 for dummies:
(2)For 骨灰级:
天天 for 骨灰级:
yy0416 for 骨灰级:
味精 for 骨灰级:
。。。
For dummies 里不要写太深,基本上就是能录个响之类的,比如对着电容器
唱这种,不要放洗手间这种,不超过五分钟能看完的东西。 |
|
D***0 发帖数: 5214 | 8 iihs有说smart好多了?dummy都是死翘...
http://www.iihs.org/iihs/news/desktopnews/new-crash-tests-demon
Mercedes C class versus Smart Fortwo
After striking the front of the C class, the Smart went airborne and turned
around 450 degrees. This contributed to excessive movement of the dummy
during rebound — a dramatic indication of the Smart's poor performance but
not the only one. There was extensive intrusion into the space around the
dummy from head to feet. The instrument panel moved up and toward the dumm... 阅读全帖 |
|
C********n 发帖数: 6682 | 9 http://www.av199.com/thread-178902-1-1.html
1.为什么电脑/硬盘做音源,比CD好?
因为人比较懒,早就看CD不舒服了,一直梦想成千上万的曲目,坐沙发上不动就能随便
换着听。前一阵子心血来潮准备动手一试电脑做音源。一开始期望值很低,希望音质和
中低端CD机差不多或稍差就可以。结果经过一个月的实践,我的结论是硬盘APE做音源
,音质绝不比CD差,也许更好(理论上是硬盘比CD转盘更好,但是我听不出来区别)
我现在的玩法是无损压缩的APE、FLAC或WAV由Foobar播放(有时44.1/16直出,有时用
SRC foobar插件软升频到96/24,比较中),接DAC USB口,DAC平衡输出到功放。CD机
的模拟输出接功放,数字输出接DAC的同轴口。
1. CD的模拟输出跟同价位DAC的输出比:不管在解析力还是全频段的平衡响应,DAC都
明显胜出。也就是说我的DAC里的DAC比我的CD里的DAC强得多。不难理解啦,因为CD里
面是转盘+DAC,转盘也是成本的啊,CD机当然比不上同价的外置DAC啦。
2. CD转盘跟硬盘比:用我DAC上的USB输入(... 阅读全帖 |
|
b*********s 发帖数: 115 | 10 非大牛
我是在最开始加一个dummy head
public class Solution {
public ListNode insertionSortList(ListNode head) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
ListNode dummy = new ListNode(Integer.MIN_VALUE);
dummy.next = head;
ListNode preNode = dummy;
ListNode curNode = dummy.next;
while (curNode != null) {
ListNode pre = dummy;
ListNode cur = dum... 阅读全帖 |
|
l****s 发帖数: 75 | 11 第二题其实就是一个reverse linked list的变种。
TreeNode* flipUpsideDown2(TreeNode* root)
{
if (!root) return NULL;
TreeNode* dummy = new TreeNode(0);
dummy->left = root;
TreeNode* right = root->right;
root = root->left;
dummy->left->left = NULL;
dummy->left->right = NULL;
while (root)
{
TreeNode* tmp = root;
root = root->left;
tmp->left = right;
right = tmp->right;
tmp->right = dummy->left;
dummy->left = tmp;
}
root... 阅读全帖 |
|
l****s 发帖数: 75 | 12 第二题其实就是一个reverse linked list的变种。
TreeNode* flipUpsideDown2(TreeNode* root)
{
if (!root) return NULL;
TreeNode* dummy = new TreeNode(0);
dummy->left = root;
TreeNode* right = root->right;
root = root->left;
dummy->left->left = NULL;
dummy->left->right = NULL;
while (root)
{
TreeNode* tmp = root;
root = root->left;
tmp->left = right;
right = tmp->right;
tmp->right = dummy->left;
dummy->left = tmp;
}
root... 阅读全帖 |
|
d*******u 发帖数: 186 | 13 这个算法太牛了,不知我的理解对不对?
void connect_sibling( Node *root ) {
root->sibling = null;
Node *cur, *dummy;
dummy = new Node;
while( root ) { //dummy->slibling是指向上次下一层的最左节点。
cur = dummy; //这样保证dummy->slibling总指向最左节点
while( root ) { // 找上一层的最右边节点, 假设当前层sibling已连好。
if( root->left ) {
cur->sibling = root->left;
cur = root->left;
}
if(root->right){
cur->sibling = root->right;
... 阅读全帖 |
|
D********g 发帖数: 650 | 14 This is a pretty tricky question, especially for the loop handling. Here is
my java code, tested with looped case and non-looped case.
public static class DLLNode {
DLLNode prev;
DLLNode next;
int value;
public DLLNode(int value) {
this.value = value;
prev = null;
next = null;
}
}
static DLLNode dummy = new DLLNode(-1);
static DLLNode loopDummy = new DLLNode(-2);
static void printLL(final DLLN... 阅读全帖 |
|
W********e 发帖数: 45 | 15 看不太出这个错在哪了,当input 是{},{0} 时候run time error了。
ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
ListNode *h1=l1,*h2=l2;
ListNode *newHead,*dummy=newHead;
if(l1==NULL&&l2==NULL)
return NULL;
while(h1!=NULL&&h2!=NULL)
{
if(h1->val>=h2->val)
{
dummy->next=h2;
dummy=h2;
h2=h2->next;
}
else
... 阅读全帖 |
|
W********e 发帖数: 45 | 16 我的办法就是进行二分,将k个链表分为两个一组,组内进行merge。形成一个新的链表
集合。继续两个一组merge,这样下去一共会进行logk次merge,最后merge成为一个链
表。这里用的辅助函数是mergeSortedList,合并两个有序链表,这个辅助函数复杂度
应该是O(n)。
我觉得这个算法的总时间复杂度是O(nlogK),大家觉得对吗??
class Solution {
public:
ListNode* mergeSortedList(ListNode*l1,ListNode*l2)
{
ListNode *h1=l1,*h2=l2;
ListNode *newHead=new ListNode(0),*dummy=newHead; //newHead要赋
值,否则没有next。如果是C语言的话可以申请stack的对象
if(l1==NULL&&l2==NULL)
return NULL;
while(h1!=NULL&&h2!=NU... 阅读全帖 |
|
g*********e 发帖数: 14401 | 17 用了一个dummy node, 记得用完删掉
class Solution {
public:
ListNode *insertionSortList(ListNode *head) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
if(head == NULL)
return NULL;
ListNode *dummy=new ListNode(0);
dummy->next=head;
head=head->next;
dummy->next->next=NULL;
while(head) {
ListNode *cur=head;
head=head->next;
... 阅读全帖 |
|
b***n 发帖数: 13455 | 18 2nd round: dummy ruffed with S2
3rd: dummy SJ finess Q
4th: dummy S3, taken by K at hand
5th: C7 from hand, taken by A of dummy
6th: dummy CK
7th: dummy small C, trumped with S7 at hand
8th: SA, SQ fell
9th: small D to A of dummy to finish |
|
t***n 发帖数: 546 | 19 鉴于有人要求详细配置,现在把几个配置文件贴出来,欢迎大牛们指正
gtalk.conf***********************
[general]
context=google-in ; Context to dump call into
allowguest=yes
[guest] ; special account for options on guest account
disallow=all
allow=ulaw
context=google-in
[dummy-gtalk]
username=d***[email protected]
disallow=all
allow=ulaw
context=google-in
connection=dummy
[user3-gtalk]
username=u***[email protected]
disallow=all
allow=ulaw
context=google-in
connection=user3
[user1-gtalk]
username=u***[email protected]
disallow=all
... 阅读全帖 |
|
t***n 发帖数: 546 | 20 phonerlite 是一个ATA设备吗?
我又试着给dummy的google voice打了个电话,并且先挂断,并没有出现你说的问题。
exten => d***[email protected], 1, GotoIf(${DB_EXISTS(gv_dialout/channel)}?bridged
) 是照前人关于一个GV帐号的配置抄的,具体我也不是很明白。本来下面所有行都应该是
exten => d***[email protected], n*************
但是我改成了
exten => _[a-z][email protected],n*************
不光match d***[email protected],而是match 所有字母开头,@gmail.com结尾的打,也就
是任意gmail帐号。我认为这样的好处是任意配置是否在电话上接听google voice。比
如:
exten => d***[email protected], 1, GotoIf(${DB_EXISTS(gv_dialout/channel)}?bridged)
exten => d****[email protected], 1, GotoIf... 阅读全帖 |
|
O**********S 发帖数: 1806 | 21 我也最受不了别人要和我较真了。
http://www.iihs.org/ratings/rating.aspx?id=992
Mitsubishi Outlander
2007-11 models
SIDE IMPACT TEST WITH STANDARD SIDE AIRBAGS
OVERALL EVALUATION: G
Injury measures Head protection Structure/safety cage
Head/neck Torso Pelvis/leg
Driver
Rear passenger
Important: Side impact crash test ratings can be compared across vehicle
type and weight categories.
Good Acceptable Marginal Poor
Test details:
The Mitsubishi Outlander was redesigned for the 2007 model yea... 阅读全帖 |
|
g********b 发帖数: 8461 | 22
Take a look at the crash results and compare between A4 and A6:
A4:Restraints/dummy kinematics — Dummy movement was well controlled. The
driver side curtain airbag deployed during the crash. After the dummy moved
forward into the frontal airbag, it rebounded into the seat with its head
grazing the sunvisor, roof, and grab handle above the deployed side airbag.
A6:Restraints/dummy kinematics — Dummy movement was well controlled.
During rebound, the dummy's head hit the roof rail.
Pay attention t... 阅读全帖 |
|
k*******2 发帖数: 84 | 23 Solution with Dummy node at the bottom. And how will recursion work here,
please?
class Solution {
public:
ListNode *deleteDuplicates(ListNode *head) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(head == NULL)
return head;
ListNode *dummy = new ListNode(0);
dummy->next = head;
ListNode *p1 = dummy;
ListNode *p2 = dummy->next;
while(p2!= NULL && p2->... 阅读全帖 |
|
a*****a 发帖数: 46 | 24 我觉得一遍就可以啊。
保存上一个小于9的节点last,每次相加,以和的个位数做新节点,如果有进位就增加
last.value,如果新节点小于9就把last移到新节点。
可以这样做的原因是,每一个节点只存一个数字,那么任何一位如果需要进位,个位数
最多为8,无论后面的数是什么都不会再进位。
public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
ListNode dummy = new ListNode(0), last = dummy, cur = dummy;
while (l1 != null && l2 != null) {
int sum = l1.value + l2.value;
cur.next = new ListNode(sum % 10);
cur = cur.next;
l1 = l1.next;
l2 = l2.next;
if (sum / 10 > 0) { // has carry
... 阅读全帖 |
|
f*******r 发帖数: 180 | 25 只需要把从last到cur之前value是9的置0就可以了把, 最坏情况下需要把整个list重
新走一边。
public static ListNode addTwoNumbers(ListNode l1, ListNode l2) {
ListNode dummy = new ListNode(0), last = dummy, cur = dummy;
while (l1 != null && l2 != null) {
int sum = l1.value + l2.value;
cur.next = new ListNode(sum % 10);
cur = cur.next;
l1 = l1.next;
l2 = l2.next;
if (sum / 10 > 0) { // has carry
last.value++;
las... 阅读全帖 |
|
s********e 发帖数: 31 | 26 Very nice, I think you made it :)
I was thinking of another line though.
1.Take the first trick with Ace of Diamond.
2.Cross the dummy with Queen of hearts
3.Play AK of Clubs in the dummy and pitch 2 diamonds in the hand.
4.Ruff a diamond back
5.Cash Ace of Heart pitch the last diamond in the dummy.
6.Cash King of Heart try to pitch the small clubs in the dummy.
a. If west does not ruff, you are home, just clear trump, dummy is up
b. If west ruff, you overruff in the dummy,
b1. Now you ruff t |
|
p******x 发帖数: 441 | 27
我当时电面的时候是一个associate prof做面试官,主要大题目就是:
1. Q: R里面做regression的时候怎么标示一个variable X1是categorical的
A: 用as.factor()
2. Q: 解释 T-test 和 paired T-test,为啥有时要用到paired T-test
A: 这个可以直接wiki,我提到自己理解paired T-test其实就是blocking的思想,
一个pair就是一个block,面试官就说可以了
3. Q:解释dummy variable和为啥要用dummy variable,为啥不每一个factor level单
独做一个估计
A:这个正好跟我做的有点相关。我的理解是不仅仅是有2个level的dummy variable
,任何k个level的categorical factor都可以对ith level单独做E(y_ij|x_i)=b_i0+b_
i1*x_i1+b_i2*x_i2+...,但是最后怎么合理的把k个b_il合并成b_l就是个问题。用
dummy var或者cat... 阅读全帖 |
|
N********n 发帖数: 543 | 28 这里是总的链条,很多详细内容,大家如果感兴趣,可以看看
http://townhall-talk.edmunds.com/direct/view/.f2281d7
Re: Sienna Ratings [indyguy5] by pact95
Mar 03, 2011 (5:01 am)
Replying to: indyguy5 (Mar 01, 2011 1:42 pm)
I wanted to provide some information I received from the NHTSA on the crash
test of the Sienna, with some
comparison to the Honda. Hopefully this helps people with their decisions.
The Toyota Sienna received a 2-star rating for the right front passenger
while the Honda Odyssey received
a 5-star. This rating i... 阅读全帖 |
|
m*********g 发帖数: 10735 | 29 lz你这是混淆视听。。
我把small overlap的injury measures转给你看看
Audi A4
•Action shot taken during the second of two small overlap frontal
crash tests.
•The dummy's position in relation to the door frame, steering wheel,
and instrument panel after the crash test indicates the driver's survival
space wasn't maintained well (second test with front and side curtain airbag
deployment).
•In the second test, the dummy moved to the left and its head slid
around the left side of the frontal airbag.
... 阅读全帖 |
|
p*********n 发帖数: 144 | 30 如题
http://www.nytimes.com/2013/05/19/automobiles/2014-forester-get
The 2014 Subaru Forester was the only one of 13 compact crossovers and S.U.V
.’s to earn the highest rating in a new, more severe front crash test by
the Insurance Institute for Highway Safety. The new Forester was rated Good,
and the 2013 Mitsubishi Outlander Sport received the next-highest rating,
Acceptable.
The insurance institute, which is financed by the insurance industry, began
conducting the new test, called the small ov... 阅读全帖 |
|
g********d 发帖数: 19244 | 31 ☆─────────────────────────────────────☆
felixcat (felixcat) 于 (Thu Mar 7 17:01:19 2013, 美东) 提到:
发现有一些人存在误解:认为碰撞测试成绩能代表有没有用高强度/超高强度/极高强度
钢材来造车身,有没有“不计成本”来给好货给消费者。从而一旦发现碰撞测试看上去
不好,就觉得车厂没有用好钢材省成本。
事实上并非这样,我下面列举一些具体的车型的车体结构,大家就能发现一些碰撞测试
成绩很好的车子,事实上并没有用很高强度的材料;而一些碰撞测试让人觉得成绩一般
的车子,事实上却是用了很不错的钢材。造成这种直觉上“对不上号”的原因在于,碰
撞测试成绩不完全取决于钢材硬度,它还跟车体形状、能量传递的设计意图有关。
首先看Audi A4。在small overlap碰撞测试成绩出来之后,这车子的结构强度在公众心
目中马上从天堂掉到了地狱。A柱拦腰截断,这不像话。
但是实际上A4车身框架用料极其足,车身结构有65%是强度超过300 MPa的高强度钢制造
;在这里面又有占全车身18%的材料是强度在500到1... 阅读全帖 |
|
X***9 发帖数: 7385 | 32 The Insurance Institute for Highway Safety (IIHS) has announced that the
2013 Toyota RAV4 has received a "poor" rating in the IIHS small overlap
front crash test. According to the IIHS a combination of poor structure and
inadequate control of the dummy's movement prevented the RAV4 from earning a
better rating.
What went wrong? In the small overlap test the driver's space was
compromised by intruding structure, and the dummy's left foot was trapped by
crushed and buckled sheet metal in the footw... 阅读全帖 |
|
f****t 发帖数: 15913 | 33 来自主题: Automobile版 - 温故而知新 顶一下felixcat的屈服强度神贴,最近猫不大给力,大家要是想领略猫的风采还是多温
习一下猫的代表作。
http://mitbbs.org/article_t/Automobile/33931299.html
*******************
标 题: [合集] 有关高强度钢用料、省成本和碰撞测试
发信站: BBS 未名空间站 (Mon Jun 17 15:54:58 2013, 美东)
☆─────────────────────────────────────☆
felixcat (felixcat) 于 (Thu Mar 7 17:01:19 2013, 美东) 提到:
发现有一些人存在误解:认为碰撞测试成绩能代表有没有用高强度/超高强度/极高强度
钢材来造车身,有没有“不计成本”来给好货给消费者。从而一旦发现碰撞测试看上去
不好,就觉得车厂没有用好钢材省成本。
事实上并非这样,我下面列举一些具体的车型的车体结构,大家就能发现一些碰撞测试
成绩很好的车子,事实上并没有用很高强度的材料;而一些碰撞测试让人觉得成绩一般
的车子,事实上却是用了很不错的钢材。造成这种直觉... 阅读全帖 |
|
w*l 发帖数: 754 | 34 America’s Most Dangerous Luxury Cars
August 15, 2012 by Mike Sauter
More than 10,000 people are killed each year in front-end crashes in the
United States. While most cars offer protection in front-end accidents,
overlap crashes, where the car is not hit head-on, are a different matter
entirely. Until now overlap crashes, which account for nearly one in four of
the front-end crashes involving serious or fatal injury to front seat
occupants, have not been tested by the government or other indepen... 阅读全帖 |
|
t******h 发帖数: 120 | 35 我一直用dummy node来做 但是昨天看到有人说有更简单的方法 请知道的赐教
我的做法 是一个队列 一个栈
循环开始前把root和dummy入队列
从队列里读结点
把这个点放到栈中 然后把他的子结点入队列
当读到dummy时 如果队列不为空 再把dummy入队列 压栈
如果队列为空 则表示从栈中输出结果 读到dummy时输出newline |
|
K*******g 发帖数: 26 | 36 跟你的思路一样,不过找第一个结点可以优化以下
struct Node{
int value;
Node *left;
Node *right;
Node *sibling;
};
void connect_sibling(Node *root){
root->sibling = 0;
Node *cur, *dummy;
dummy = new Node;
while(root){
cur = dummy;
while(root){
if(root->left){
cur->sibling = root->left;
cur = root->left;
}
if(root->right){
cur->sibling = root->right;
cur = root->right;
... 阅读全帖 |
|
k***t 发帖数: 276 | 37 本人一直只写C,看过一点STL。欢迎大家 Code Review。谢谢。
觉得has_next_level flag 部分不够简单明了,但没有它不好
在输出中换行和终止加dummy node.
#include
using namespace std;
typedef struct TreeNode_ {
int value;
struct TreeNode_ *left;
struct TreeNode_ *right;
} TreeNode;
int level (TreeNode *root) {
queue Q;
TreeNode *cur, dummy;
bool has_next_level;
if (!root) return -1;
Q.push(root); Q.push(&dummy);
has_next_level = false;
while(!Q.empty()) {
cur = Q.front();
... 阅读全帖 |
|
s*****n 发帖数: 994 | 38 void removeNode(int val, LinkedList **list){
LinkedList* dummy = new LinkedList(0);
dummy->next = *list;
LinkedList* current = dummy;
while (current){
if (current->next){
if (current->next = val){
current->next = current->next->next;
}else{
current = current->next;
}
}else{
current = current->next;
}
}
*list = dummy->next;
delete dummy;
}
直没
N |
|
s*****n 发帖数: 994 | 39 void removeNode(int val, LinkedList **list){
LinkedList* dummy = new LinkedList(0);
dummy->next = *list;
LinkedList* current = dummy;
while (current){
if (current->next){
if (current->next = val){
current->next = current->next->next;
}else{
current = current->next;
}
}else{
current = current->next;
}
}
*list = dummy->next;
delete dummy;
}
直没
N |
|
l******6 发帖数: 340 | 40 struct node;
void print100(stack& waitStack);
struct childList{
node* curNode;
childList* next;
};
struct node{
void* data;
childList* children;
};
void print(node* root)
{
if(!root)
return;
childList* dummy = new childList();
dummy -> curNode = root;
dummy -> next = NULL;
stack waitStack;
waitStack.push(dummy);
while(!waitStack.empty())
{
print100(waitStack);
}
delete dummy;
}
void print1... 阅读全帖 |
|
a***e 发帖数: 413 | 41 Update:
终于写出来了。。。。。去掉prev2 = p->next;就对了。
还是欢迎大牛们指点,讨论哈!哎,不知哪年哪月才能练到能去面试的。。。。。。
独自刷题非常郁闷。
Reverse Nodes in k-Group
https://oj.leetcode.com/problems/reverse-nodes-in-k-group/
Given a linked list, reverse the nodes of a linked list k at a time and
return its modified list.
If the number of nodes is not a multiple of k then left-out nodes in the end
should remain as it is.
You may not alter the values in the nodes, only nodes itself may be changed.
Only constant memory is allowed.
For example,
Give... 阅读全帖 |
|
a***e 发帖数: 413 | 42 这道题和1我都是觉得iterative的比recursive的好写,看别人答案也更容易懂,(压
根儿没写出通过的recursion来)。下面这个都不知道思路是怎么地,特别是怎么能
connect(dummy.next);就保证 dummy.next 就是下一层的第一个了呢?见笑哈。
如果明天还看不出来就去VS里面调调。。。。。。
void connect(TreeLinkNode *root) {
if (root==NULL) return;
TreeLinkNode dummy(-1);
for (TreeLinkNode *cur = root, *prev=&dummy; cur; cur = cur->next)
{
if (cur->left!=NULL){
prev->next = cur->left;
prev = prev->next;
}
... 阅读全帖 |
|
a***e 发帖数: 413 | 43 回国一趟回来做题很难进入状态了
Merge k sorted linked lists and return it as one sorted list. Analyze and
describe its complexity.
有人面试碰到这题么?我洋洋洒洒写了很多代码,OJ说Time Limit Exceeded
class Solution {
public:
ListNode *mergeKLists(vector &lists) {
int n = lists.size();
if (n==0) return NULL;
ListNode *ret = lists[0];
for (int i=1; i
{
ret = merge2Lists(ret, lists[i]);
}
return ret;
}
private:
ListNode *merge2Lists(ListNod... 阅读全帖 |
|
s***5 发帖数: 2136 | 44 very messy code with bugs.
for linked list related questions, you should always first check if a the "
head" is null or not.
it is not a special case when the head is the node you need to delete.
Node* deleteNode(Node *head, int data) {
if(head == NULL) return;
Node *dummy = new Node(0);
dummy->next = head;
Node *p = dummy;
while(p->next != NULL && p->next->val != data)
p = p->next;
if(p->next == NULL) return;
Node *tmp = p->next;
p->next = p->next->next;
... 阅读全帖 |
|
t*******r 发帖数: 22634 | 45 挖坑就要勇于承认,tally mark 上网 google 一下有冰箱贴,
又不是 quantum chromodynamics。
当然我刚才不小心 google 了一下 quantum chromodynamics,
发现现在这玩意儿也有冰箱贴啦哈哈哈!!Quantum Chromodynamics
For Dummies!!
http://www.dummies.com/how-to/content/string-theory-and-quantum
特么真的是时代不同了,现在不懂 quantum chromodynamics 算
是 dummies。。。哦,不对,现在懂了 quantum chromodynamics
才有资格做 dummies,否则是 dummies 不如。。。看这趋势,将来
小学毕业不懂 quantum chromodynamics 的,那麦当劳翻烧饼的
面试都过不了,直接送废柴管理处排队领 food stamp。。。 |
|
a*******s 发帖数: 295 | 46
if Spade 3-2 , everything is ok, you pull trump, ruff a diamond in
dummy.
but if spade 4-1, because trump is 3-1, you have no practical strip
play. and if you ruff diamond in dummy, that only give you 10 tricks.
However, you can improve your chance by ruff 2 club in hands
reversed-dummy play perserve your diamond menace.to control the right
timing, you need to concede your diamond loser now, and win any return
in dummy, ruff another club, go to dummy again, pull the last trump,
the defender hol |
|
p***r 发帖数: 20570 | 47 Some thoughts on one hand
This hand was played in the bbo money bridge game. You play with a robot,
your LHO also plays with a robot. The score format is total points.
You hold Ax K9x xx AKQ8xx , both white,
The first question is what to open?
Of course 1NT is a possible choice. However, this hand is probably
too strong for 1NT because of the strong suit in clubs. You don't need
a lot from partner to make 3NT. So you should open 1C, even play with
a robot.
The bidding develops :
1C p 1D 1H ?
Now... 阅读全帖 |
|
p***r 发帖数: 20570 | 48 of course it has to be HJ. If partner plays HJ, the defense would become
rather tough. It is usually reasonable to play partner for 4-4-2-3 or 4-3-2-
4 shape.
suppose declarer holds something like xxxxx x KQTxx xx, you have to play DA
and Dx. Declarer can play SA, ruff, H, ruff S, ruff H, draw trump and play C
. You have to play CA and shoot back S. to beat it for one trick. if
partner holds DKx and SKxxx, DA and low D would cost you two tricks (because
you just play low D, you would be able to ... 阅读全帖 |
|
t*******r 发帖数: 22634 | 49 这个我实话实说,术业有专攻。
比如俺这种对后期不太感兴趣的,基本看不完那些后期的篇章。
要我说“后期 for dummies”,基本上考虑这么写。
后期 for dummies:
后期 for dummies using Audacity:
(1)下载 Audacity: (link)
(2)拖音轨进去
(3)Normalize 到 -3 dB
(4)切头切尾,移动对准,安静空段
(5)分段 Amplify
(6)Compressor,建议 -12 dB threshold, 2.5:1 ratio,attack 0.2,
release 1.0
(7)Gverb,建议参数 40, 4, 0.9, 0.75,0,-22,28
(8)Mix & Render
(9)Normalize 到 0 dB
(10)Export mp3,完工。
后期for dummies using CE:
。。。
dummies 需要的不是对软件效果的高深理解,而是找到对应的 pre-arr... 阅读全帖 |
|
s*****n 发帖数: 2174 | 50 第一个问题: ?date, ?Date
比如
> today <- Sys.Date()
> print(today)
[1] "2008-11-20"
> print(today + 1)
[1] "2008-11-21"
> print(today + 365)
[1] "2009-11-20"
> print(today - as.Date("2008-01-01"))
Time difference of 324 days
> print(as.numeric(today - as.Date("2008-01-01")))
第二个问题:
如果你的dummy variable 都是同样长度的, 最好的办法是用一个矩阵储存这些dummy
variable. 而矩阵的列name, 可以设为 paste("dummy", i, sep="")
如果你的dummy variable 不一定是同长度, 那么只能用list来储存, list的每一个元
素, 是一个dummy variable, 名字是"dummyi", 比如下面的script
variablelist <- list()
f |
|