栈的问题!高手们快出手救救小第!!!!!谢谢!!! 有一个问题:"设单链表中存放n个字符,设计一个算法,使用栈判断该字符串是否中心对称!如xyzzyx既为中心对称字符串!!"请问怎么设计算法???能详细说说吗??谢谢!!! 一名初学数据结构的学生 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把单链表压入栈A,同时得到字符串的长度,再建立一个栈B,从栈Apop全部字符的一半同时push到栈B,然后栈A和栈B同时pop比较不就可以了吗? 同意楼上: if (! 链表长度 % 2 ) { MessageBox("It's not!"); return; } CString str; str = push( 链表长度 % 2 ); // 将前一半压站 for(int i = 0; i < 链表长度 % 2; i++) { if( pop( i ) ! = string[ 链表长度 / 2 + i ] ) // string 是链表数据 { MessageBox("It's not"); return; } } MessageBox("HO ! It is"); 笔误!if ( 链表长度 % 2 != 0) { MessageBox("It's not!"); return; } CString str; str = push( 链表长度 / 2 ); // 将前一半压站 for(int i = 0; i < 链表长度 / 2; i++) { if( pop( i ) != string[ 链表长度 / 2 + i ] ) // string 是链表数据 { MessageBox("It's not"); return; } } MessageBox("HO ! It is"); xyzyx是否为中心对称?如果是的话,那么楼上的可能只做了一半的工作。 HKer_007(伙计,拿杆烟来吃)不就是大侠吗!现场编程啊! 学习数据结构HKer_007(伙计,拿杆烟来吃)用MFC来做有点过了!Win32 Console就行了!xfr_1982(独孤一笑) 你会建栈吗?呵呵! 求助 关于CButtonST的??? 我如何得到指定ip地址本地网卡的mac地址 析构函数的问题! 星期一到北京面试的感受! 请问如何把视图清空? VC6.0英文版哪里有下载?????谢谢,告诉我分全是你的 如何存取数据通过串口接收的频谱仪波形数据? 急!急!急!材料力学上机需要编程,哪位高手能帮忙解决啊? 工作之路.. 为什么我的对话框不能正常响应WM_CHAR 消息? 请教 请教一个关于Combo Box的问题
{
MessageBox("It's not!"); return;
}
CString str;
str = push( 链表长度 % 2 ); // 将前一半压站
for(int i = 0; i < 链表长度 % 2; i++)
{
if( pop( i ) ! = string[ 链表长度 / 2 + i ] ) // string 是链表数据
{
MessageBox("It's not"); return;
}
}
MessageBox("HO ! It is");
{
MessageBox("It's not!"); return;
}
CString str;
str = push( 链表长度 / 2 ); // 将前一半压站
for(int i = 0; i < 链表长度 / 2; i++)
{
if( pop( i ) != string[ 链表长度 / 2 + i ] ) // string 是链表数据
{
MessageBox("It's not"); return;
}
}
MessageBox("HO ! It is");
如果是的话,那么楼上的可能只做了一半的工作。
Win32 Console就行了!xfr_1982(独孤一笑) 你会建栈吗?呵呵!