数据结构中

int sortL(SqList &L1,SqList &L2,SqList &L3){
int i=1,j=1,k=1;
while(i<=L1.length&&j<=L2.length)
{
    if(L1.elem[i-1]<=L2.elem[j-1])
    {
        ListInsert_Sq(L3,++k,L1.elem[i-1]);i++;
     }
     else{
     ListInsert_Sq(L3,++k,L2.elem[j-1]);j++;
     }
     }
     return 1;
     }

已知L1,L2为线性顺序表,合并起来为L3,这样写发现L3里面只有L1.length<L2.length? L1.length:L2.length 个,哪错了???

萌新程序猿orz
浏览 850回答 2
2回答

慕设计2395807

DTQFOZQYVEULVQGVSHDLVRCZBRGKUXAQMUDMDMIXGCYIKACSBYOFORHZODGCSCFOXHFVEUQZCTCFUCEFCEOFJSVFYNKSUXGPFOLOLBXGPFORHPMPYUJGWFILUGCLUEMBEHDTADFCENDUDTJVXGEUKZJFIYEHDTPLWXAWFGCETPFOEUDTLAJXGWMVLBETJYHRUFVYUKUWLIYBXAJGIEHPMCZVFOEAFBQMJYCXADZAORTENKMWGPSUKUCFVRHXZUWFHEBKOEUJRZJFUXAQMWFJFBKNWYVYHXRGPMIEODNWMOKMPSVSJFILRAJUWAJSAXTLHQMWSBRNWFQMBFOYVXZPEBLNDMIYBKUPMJZPTPSCYOXZCXAWZDADGPUKNXSVKBKNQBXLBFVWTCFVYUWMDAKGJGJCLHDGPZULOQFCEHXGQNJZPPRNQFPZWMWFHEZWMVLUKZPZWECYPRHEHWBXMKTPFUDSVQMVRTQNIFOYPMOXGJTQTJMGWTDZVYAPLIPRTDYAXTQZIVRGDGJFBRHEWRGJLOYUJMQYACSBLAQKUQJFBXHJZCFVXZILIKUXAQNCXSVYNXFOEAQEACGCLBRTWGXHQGJTWGCLNTVYOXURGWTCGPYUKNQMBYUORTJFBRGCMVNDTDGPEBKNQENWNJYVLBRNVDGCMUDUKNJRUWTWAWAWZPWYHRGCRHXNJEBCFBZWTJFICLBLMISBKUWGWMBQNQMPSVHDGWAJTPFIKMWZZLBRTTTZNKFCSCFVEHDTJLOLOYIEZBWZIYBYVMOWTXUQNXZOQMCSDMOEAXZQFJYLNWTJSOKGWYUJMVEHKGJLIMVKBEGCRUDMFIKADMCZPEHHEMPMHXHQAWWSORAXTJFVFBPEUKGIYUDT
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

数据结构