【ARTS】29 week

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_22073849/article/details/81276125

Algorithm

题目描述:

涉及一个算法,对给定的一个整型m×n矩阵A,统计这个矩阵中具有下列特征的元素个数并输出它们的坐标及数值:它们既是所在行中的最小值,又死所在列中的最小值;或者它们既是所在行中的最大值,又是所在列中的最大值。假设矩阵中元素各不相同,要求结果在处理过程中用输出语句输出。

解题思路:

需要找出某行上的最小值(最大值),然后判断其是否为对应列上的最小值(最大值),若是则输出。

思路不是很复杂,但是过程看着比较繁琐,比较考研自己的逻辑能力

下面给出最普遍的做法的C++实现



void printmin(int A[][maxSize], int m, int n){
    int i, j, k, min, minj;
    //用minj来记录第i行上最小值的列号
    // min来记录当前行的最小值
    int flag; //用它来进行标注,当前元素是否符合输出的标准。
    for(i = 0; i < m; ++i){
        //找出第i行上的最小值,列号为minj
        min = A[i][0];
        minj = 0;
        for(j = 1; j<n; ++j){
            if(A[i][j]<min){
                min = A[i][j];
                minj = j;

            }
        }
        //进行到此时已经找出了本行最小的元素,并且已经记下了列数,但是还有个问题就是要验证一下这个元素是不是在本列也是最小,如果是,那么符合输出标准,如何不是,那么不符合,继续扫描下一行。

        flag = 1;
        for(k=0;k<m;++k){   //判断min是否为minj列上的最小值
            if(min>A[k][minj]){
                flag = 0;
                break;
            }
        }
        if(flag)
            cout<<min<<",["<<i<<","<<minj<<"]"<<"  ";
        //打印最小值,其格式为min, [i,minj]

    }
    cout <<endl;

}


void printmax(int A[][maxSize], int m, int n){
    //做法和上面是差不多的,其实可以放到一个循环里,只不过稍稍有点乱,理清一下思路再写就好啦。

    int i,j,k,max,maxj;
    int flag;
    for(i=0;i<m;i++){
        max = A[i][0];
        maxj=0;
        for(j=1;j<n;++j)
            if(A[i][j]>max)
            {
                max = A[i][j];
                maxj = j;
            }
        flag = 1;
        for(k=0;k<m;++k)
            if(max<A[k][maxj]){
            flag = 0;
            break;
        }
        if(flag)
            cout << max << ",[" << i << ", " << maxj << "]" << "  ";
        //打印最大值,其格式为max,[i,maxj]

    }
    cout <<endl;
}



Review

【如何构造一个可以自主思考的机器(第一部分)】How to make an idea machine, part one

本文内容概要:

“Give a person a discovery from data, and they will innovate for a day. Teach a person to make discoveries from data, and they will innovate for a lifetime.” — Ancient Data Science Proverb

we can’t train enough data scientists to meet even today’s demand, and the size and variety of data being collected by organizations is increasing exponentially by the minute. Simply training more data scientists will not solve this problem

这就是作者提出这个问题的主要原因

根据过去在数据工作的经验,总结出了the greatest probability of producing a high-impact discovery comes from repeatedly connecting the right person with the right information.这样的经验,在给出两个合适人选后,

随后提出了三个问题(Three major problems are evident in this process):

  • Time.
  • Limited resources
  • Giving up too early.

最后总结出”低效流程(通常)的解决方案是自动化”

并顺便介绍了一下他关于本次命题的第二部分的文章介绍:

In part two, I provide specific details on how creative software design and architecture can automate a significant portion of the bottlenecks described above — accelerating discovery by an order of magnitude — for any data source. And just like other processes have been improved by automation, it feels like magic.

这个文章下次再带给大家。

本文通过五个方面阐述了做一个”木工”为什么会让自己在敲程序方面有所建树,他给出了五个理由:

  • It will teach you utility

  • It will teach you to troubleshoot

  • It will teach you bootstrapping

  • It will teach you progress

  • It will teach you work backwards

* 本篇文章阐述了作者在通过日常生活中的接触到的”木工”工作,引发的一系列的思考——它和coding很像,并且可以在某方面给你更新的思考 *
正如文章开头所说的那样

Many adept technologists agree that being good at one thing is the same as being good at none; “two is one and one is none”. Those who can work across many disciplines — the polymaths — will dominate the future of business.

关键词:ProgrammingData Science LifeCodeComputer Science

Technique

室友发了一个关于”if怪”的图片,表示在交接代码时受不了同事了,然后另一个室友发出了自己的代码,表示自己其实就是一个”if怪”、
123
于是我建议他用如下方法
12334

就轻松解决了,调用的时候可以直接用key对字典进行索引,这样一来方便向反转前的字典中加入新的keyvalue,方便维护又美观。

另外关于字典反转,看到了下面几个文章,比较不错,虽然没有用到,但是希望以后有时间回过头看看。

Python反转/反转映射

还有这篇文章,也可以进行字典反转,不过相当于我的工作的逆操作(也就是dict2->dict1)

dictionary - 如何反转具有重复值的字典( python )

Share

GitHub Awesome Big Data:大数据框架、论文等实用资源集合。

非常全的大数据相关资源整理

其中包括:

  • 关系数据库管理系统(RDBMS)
  • 框架
  • 分布式编程
  • 分布式文件系统
  • 键-值数据模型
  • 图形数据模型
  • Columnar Databases
  • SQL-like processing
  • Data Ingestion
  • Service Programming
  • Scheduling
  • Machine Learning
  • Benchmarking
  • Security
  • System Deployment
  • Applications
  • Search engine and framework
  • MySQL forks and evolutions
  • PostgreSQL forks and evolutions
  • Memcached forks and evolutions
  • Embedded Databases
  • Business Intelligence
  • Data Visualization
  • Internet of things and sensor data
  • Interesting Readings
  • Interesting Papers

猜你喜欢

转载自blog.csdn.net/qq_22073849/article/details/81276125