摘要: //约瑟夫环(约瑟夫问题)是一个数学的应用问题:已知n个人(以编号1,2,3...n分别表示)围坐在一张圆桌周围。从编号为k的人开始报数,数到m的那个人出列; //其他的下一个人又从1开始报数,数到m的那个人又出列;依此规律重复下去,直到圆桌周围... public class App5_3 { p 阅读全文
posted @ 2019-07-04 13:28 bobo哥 阅读(289) 评论(0) 推荐(0)
摘要: //查找最大数和次大数 import java.util.Scanner; public class App5_2 { public static void main(String[] args) throws Exception { int i,max,sec; int []a=new int[8 阅读全文
posted @ 2019-07-04 13:21 bobo哥 阅读(2145) 评论(0) 推荐(0)
摘要: //逆序打印数组元素,并显示数组长度 public class App5_1 { final static int N=5; public static void main(String[] args) { int i; int[] a; a=new int[N]; for(i=0;i<N;i++) 阅读全文
posted @ 2019-07-04 13:16 bobo哥 阅读(312) 评论(0) 推荐(0)
摘要: // // main.cpp // Grpah_DFS_BFS // // Created by duanqibo on 2019/7/3. // Copyright © 2019年 duanqibo. All rights reserved. // 无向图和有向图的深度遍历和广度遍历 #inclu 阅读全文
posted @ 2019-07-03 14:32 bobo哥 阅读(7686) 评论(0) 推荐(0)
摘要: #include <stdio.h> void straightinsert_sort(int R[],int n) { int i,j; int temp; for(i=1;i<=n;i++) { temp=R[i]; j=i-1; while(temp<R[j]) { R[j+1]=R[j]; 阅读全文
posted @ 2019-07-02 13:04 bobo哥 阅读(156) 评论(0) 推荐(0)
摘要: //按姓名快速排序 #include <stdio.h> #include <string.h> #define N 10 typedef struct student { int num; char name[20]; char sex[2]; int age; }stu[N]; int quic 阅读全文
posted @ 2019-07-02 12:50 bobo哥 阅读(340) 评论(0) 推荐(0)
摘要: 源程序: #include <stdio.h> #include <stdlib.h> //二叉排序树节点描述 typedef int DataType; typedef struct Node { DataType key; struct Node *lchild, *rchild; struct 阅读全文
posted @ 2019-07-02 09:36 bobo哥 阅读(1698) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream> #include <algorithm> #include <functional> #include <iomanip> #include <stdlib.h> const int MAXSIZE = 10; using namespace std 阅读全文
posted @ 2019-07-02 09:17 bobo哥 阅读(1026) 评论(0) 推荐(0)
摘要: 例1 寻找最大数 #include <stdio.h> main() { int i,max,a[]={4,8,1,3,6,9,10,2}; max=a[0]; for(i=1;i<8;i++) { if ( a[i]>max) max=a[i]; } printf("\max=%d\n",max) 阅读全文
posted @ 2019-07-01 13:06 bobo哥 阅读(213) 评论(0) 推荐(0)
摘要: //简单 // main.cpp // Print_xing // // Created by duanqibo on 2019/7/1. // Copyright © 2019年 duanqibo. All rights reserved. // 输出由“*”组成的菱形 #include <ios 阅读全文
posted @ 2019-07-01 12:57 bobo哥 阅读(2244) 评论(0) 推荐(0)