Click here to Skip to main content
15,888,016 members

onlinewan - Professional Profile



Summary

    Blog RSS
10
Authority
18
Debator
124
Organiser
426
Participant
0
Author
0
Editor
0
Enquirer
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Reputation

Weekly Data. Recent events may not appear immediately. For information on Reputation please see the FAQ.

Privileges

Members need to achieve at least one of the given member levels in the given reputation categories in order to perform a given action. For example, to store personal files in your account area you will need to achieve Platinum level in either the Author or Authority category. The "If Owner" column means that owners of an item automatically have the privilege. The member types column lists member types who gain the privilege regardless of their reputation level.

ActionAuthorAuthorityDebatorEditorEnquirerOrganiserParticipantIf OwnerMember Types
Have no restrictions on voting frequencysilversilversilversilver
Bypass spam checks when posting contentsilversilversilversilversilversilvergoldSubEditor, Mentor, Protector, Editor
Store personal files in your account areaplatinumplatinumSubEditor, Editor
Have live hyperlinks in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Have the ability to include a biography in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Edit a Question in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Edit an Answer in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Delete a Question in Q&AYesSubEditor, Protector, Editor
Delete an Answer in Q&AYesSubEditor, Protector, Editor
Report an ArticlesilversilversilversilverSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubEditor, Mentor, Protector, Editor
Edit other members' articlesSubEditor, Protector, Editor
Create an article without requiring moderationplatinumSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending QuestionProtector
Approve/Disapprove a pending AnswerProtector
Report a forum messagesilversilverbronzeProtector, Editor
Approve/Disapprove a pending Forum MessageProtector
Have the ability to send direct emails to members in the forumsProtector
Create a new tagsilversilversilversilver
Modify a tagsilversilversilversilver

Actions with a green tick can be performed by this member.


 
General带有扩展功能的ListCtrl Pin
onlinewan20-May-10 21:00
onlinewan20-May-10 21:00 
General[MFC]当Explorer进程重启后,确保程序的托盘图标还正常显示在任务栏中 Pin
onlinewan26-Apr-10 20:09
onlinewan26-Apr-10 20:09 
General用VC开发截图小工具 Pin
onlinewan20-Apr-10 21:56
onlinewan20-Apr-10 21:56 
GeneralCComboBox的下拉列表实现自适应宽度 Pin
onlinewan13-Apr-10 17:02
onlinewan13-Apr-10 17:02 
General给刚刚毕业或即将毕业的同学一封信---从自身经历谈找工作 Pin
onlinewan30-Mar-09 17:48
onlinewan30-Mar-09 17:48 
General计划为什么不能如期完成? Pin
onlinewan26-Mar-09 17:29
onlinewan26-Mar-09 17:29 
General在ARX中利于Automation打开、新建DWG文件 Pin
onlinewan22-Mar-09 15:33
onlinewan22-Mar-09 15:33 
General收藏 [modified] Pin
onlinewan15-Mar-09 16:19
onlinewan15-Mar-09 16:19 
General企业制度与文化 Pin
onlinewan10-Mar-09 23:06
onlinewan10-Mar-09 23:06 
General2005年百度之星程序设计大赛试题初赛题目三 Pin
onlinewan3-Nov-08 19:06
onlinewan3-Nov-08 19:06 
General2005年百度之星程序设计大赛试题初赛题目二 Pin
onlinewan3-Nov-08 19:02
onlinewan3-Nov-08 19:02 
General2005年百度之星程序设计大赛试题初赛题目一 Pin
onlinewan3-Nov-08 18:47
onlinewan3-Nov-08 18:47 
General实现在Word中查找指定内容,将其替换为指定图片 Pin
onlinewan23-Oct-08 15:12
onlinewan23-Oct-08 15:12 
General实现在Excel中查找指定内容,将其替换为指定图片 Pin
onlinewan23-Oct-08 15:04
onlinewan23-Oct-08 15:04 
General【某公司C++笔试题】 [modified] Pin
onlinewan12-Oct-08 22:57
onlinewan12-Oct-08 22:57 
General四道微软面试算法题 [modified] Pin
onlinewan12-Oct-08 16:28
onlinewan12-Oct-08 16:28 
/****************************************************************************
题目要求 :一个整数数列,元素取值可能是0~65535中的任意一个数,相同数值不会重复出现。0是例外,可以反复出现。
请设计一个算法,当你从该数列中随意选取5个数值,判断这5个数值是否连续相邻。
注意:
- 5个数值允许是乱序的。比如: 8 7 5 0 6
- 0可以通配任意数值。比如:8 7 5 0 6 中的0可以通配成9或者4
- 0可以多次出现。
- 复杂度如果是O(n2)则不得分。

用C描述的算法
功能 :判断随意取的数值是否连续相邻,相邻返回1,否则返回0
参数array :存储随意取的数
参数size :随意取的数的个数
****************************************************************************/
int is_progression(array, size)
{
/*最大值的索引和最小值的索引*/
maxIndex = 0;
minIndex = 0;

i = 0;
/*试图找到第一个不为0的元素,初始化maxIndex和minIndex*/
for ( ; i < size; ++i )
{
if ( array[i] != 0 )
{
maxIndex = minIndex = i;
break;
}
}

/*试图确定随意取的数中的最大值和最小值*/
for ( ; i < size; ++i )
{
if ( array[i] > array[maxIndex] )
{
maxIndex = i;
}
else if ( array[i] < array[minIndex] )
{
minIndex = i;
}
}

/*如果最大值和最小值的差小于总个数,则可以判定它们是连续相邻的*/
return (array[maxIndex] - array[minIndex]) < size ? 1 : 0;
}


/****************************************************************************
题目要求 :设计一个算法,找出二叉树上任意两个结点的最近共同父结点。
复杂度如果是O(n2)则不得分。

用C描述的算法,注释略
****************************************************************************/
typedef int datatype
typedef struct tree_node{
datatype data;
struct tree_node *lchild;
struct teee_node *rchild;
}treenode, *lptreenode;
treenode* find_parentnode(tree, node1, node2)
{
initstack(s);
push(s, tree);
finded = 0;
parentnode = tree;

while ( !stackempty(s) )
{
while ( gettop(s, p) && p )
{
if ( p == node1 )
{
finded += 1;
}
if ( p == node2 )
{
finded += 1;
}

if ( finded == 0 )
{
parentnode = p;
break;
}
else if ( finded == 2 )
{
break;
}

push(s, p->lchild);
}

if ( finded == 3 )
{
break;
}
else if ( parentnode != NULL )
{
while ( pop(s, p) && p == parentnode )
{
break;
}

push(s, p->rchild);
}
}

return finded == 3 ? parentnode : NULL;
}


/****************************************************************************
题目要求 :一棵排序二叉树,令 f=(最大值+最小值)/2,设计一个算法,找出距离f值最近、大于f值的结点。
复杂度如果是O(n2)则不得分。

用C描述的算法,注释略
****************************************************************************/
treenode* find_parentnode(tree, f)
{
tempnode = tree;
while ( tempnode )
{
if ( tempnode->data > f )
{
if ( NULL == tree->lchild
|| tree->lchild->data <= f )
{
break;
}

tempnode = tree->lchild;
}
else
{
if ( NULL == (tempnode = tempnode->right)
|| tempnode->data > f )
{
break;
}
}
}

return tempnode;
}


/****************************************************************************
题目要求 :一个整数数列,元素取值可能是1~N(N是一个较大的正整数)中的任意一个数,相同数值不会重复出现。
设计一个算法,找出数列中符合条件的数对的个数,满足数对中两数的和等于N+1。
复杂度最好是O(n),如果是O(n2)则不得分。

用C描述的算法
****************************************************************************/
int get_numberpair_count(array, size, N)
{
count = 0;
temp_array_size = N / 2 + 1;
temp_index = 0;

temp_array[temp_array_size];

for ( i = 0; i < size; ++i )
{
temp_index = array[i] < temp_array_size ? array[i] : (N-array[i]);
if ( temp_array[temp_index] == 1 )
{
++count;
}
else
{
temp_array[temp_index] = 1;
}
}

return count;
}

modified on Thursday, October 23, 2008 9:13 PM

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.