第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

c語言數(shù)據(jù)結構基礎問題

c語言數(shù)據(jù)結構基礎問題

MYYA 2018-12-30 04:00:30
查看完整描述

1 回答

?
波斯汪

TA貢獻1811條經(jīng)驗 獲得超4個贊

是這個意思嗎?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

#include <stdlib.h>

#include <iostream>

#define OK 1

#define MVNum 3

typedef int Status;

typedef char VerTexType;

typedef int ArcType;

struct edge//(結構)

{

    VerTexType adjvex; //最小邊的頂點

    ArcType lowcost; //最小邊的權值

}closedge[ MVNum ]; //輔助數(shù)組

 

Status Min() {

    int N,x,min=closedge[1].lowcost;

    for( x = 1; x < MVNum; x++) {

        if(min > closedge[x].lowcost)

            min = closedge[x].lowcost;//找closedge數(shù)組中權值最小的那組

        N = x;//N保存權值最小的那組的下標

    }

    std::cout<<N;//輸出最小權值對應的那組數(shù)組的下標

    return OK;

}

 

int main(void)

{

    closedge[0].adjvex = 'A';

    closedge[0].lowcost = 3;

    closedge[1].adjvex = 'B';

    closedge[1].lowcost = 2;

    closedge[2].adjvex = 'C';

    closedge[2].lowcost = 1;

    Min();

    getchar();

    getchar();

    return 0;

 

}

 


查看完整回答
反對 回復 2019-01-03
  • 1 回答
  • 0 關注
  • 875 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號