`
javayestome
  • 浏览: 1006759 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

tableau problem

J# 
阅读更多
Problem 1: Young tableau
An m × n Young tableau is an m × n matrix such that the entries of each row are in sorted order
from left to right and the entries of each column are in sorted order from top to bottom. Some of the
entries of a Young tableau may be ∞, which we treat as nonexistent elements. Thus a Young tableau
can be used to hold r ≤ mn numbers.
Here’s an example of a 4x4 Young tableau containing the elements {9, 16, 3, 2, 4, 8, 5, 14, 12}. Note that
this is not unique.

2 4 9

3 8 16
∞ ∞
5 14
∞ ∞ ∞
12



//the young tableau problem


#include<stdio.h>

#define M 4
#define N 4
#define BIGGEST 9999

int matrix[M][N]={{0,1,2,4},
{0,2,3,5},
{1,3,4,0},
{0,4,5,6}};

void print()
{
int i=0,j;
for(;i<M;i++)
{
for(j=0;j<N;j++)
printf("%d ",matrix[i][j]);
printf("\n");
}
}

void youngify(int a[M][N],int x,int y)
{
int smallx=x;
int smally=y;
if((x+1)<M&&a[x+1][y]<a[x][y])
{
smallx=x+1;
smally=y;
}
if((y+1)<N&&a[smallx][smally]>a[x][y+1])
{
smallx=x;
smally=y+1;
}
if(smallx!=x||smally!=y)
{
int temp=a[smallx][smally];
a[smallx][smally]=a[x][y];
a[x][y]=temp;
youngify(a,smallx,smally);
}
}


int extract_min()
{
int x=matrix[0][0];//get the miniest
matrix[0][0]=BIGGEST;
youngify(matrix,0,0);
return x;
}


void decreasekey(int a[M][N],int x,int y,int d)
{
if(a[x][y]<=d) return;
a[x][y]=d;
int threshold=BIGGEST;
int largestx=x;
int largesty=y;
int temp;
while((x>1||y>1)&&a[x][y]<threshold)
{
temp=a[x][y];
a[x][y]=a[largestx][largesty];
a[largestx][largesty]=temp;

x=largestx;
y=largesty;
if(x-1>=0&&a[largestx][largesty]<a[x-1][y])
{
largestx=x-1;
largesty=y;
}
if(y-1>=0&&a[largestx][largesty]<a[x][y-1])
{
largestx=x;
largesty=y-1;
}
threshold=a[largestx][largesty];
}
}


void insert(int a[M][N],int d)
{
decreasekey(a,M-1,N-1,d);
}


int main(int argc,char** argv)
{
print();
int i=extract_min();
printf("After Extract %d\n",i);
print();
printf("After Insert %d\n",5);
insert(matrix,5);
print();
return 0;
}
分享到:
评论

相关推荐

    Tableau 10.4破解版

    Tableau 10.4 破解版,win10可用!!!无需时间驻留。

    Tableau 超市数据集

    Tableau 超市数据集

    Tableau 数据处理:计算平均值容易犯的错

    内容概要:【Tableau bug合集2:计算平均值容易犯的错】一文的辅助资料,用于讲解avg(分子/分母)和sum(分子)/sum(分母)的差异。该资源包含Excel版本的数据及统计结果和Tableau版本的统计结果。 适合人群:tableau...

    Tableau 8权威指南

    数据可视化Tableau教程,想做数据可视化方面的可以看看,数据可视化利器。

    Tableau项目练习素材

    有同学在博文下留言需要tableau项目练习素材,上传供大家练习使用,希望能帮到需要的同学~

    Tableau Server 10.1 入门指南

    Tableau Server 10.1 入门指南

    tableau超市数据实战

    tableau官方下载的超市原始数据,用于tableau实战练习

    Tableau文字云實作

    tableau 文字云操作範例實作, 以關鍵字搭配其計量數, 呈現字關鍵字文字云, 出現次數多的字較大

    Tableau 图表大全

    Tableau 图表大全

    [Tableau] Tableau 数据可视化 开发技巧 (英文版)

    [Packt Publishing] Tableau 数据可视化 开发技巧 (英文版) [Packt Publishing] Tableau Data Visualization Cookbook (E-Book) ☆ 图书概要:☆ Over 70 recipes for creating visual stories with your data ...

    Practical Tableau-O'Reilly(2018).epub

    Eight years ago, my then-boss asked our team of three analysts to try using a “new” tool called Tableau. All three of us did the first thing that came naturally and attempted to replicate our ...

    tableau表扩展-填补缺失日期

    资源内包含tableau模板源文件,文本说明,python脚本文件,有需要的可以自行下载

    Tableau 数据可视化与实战 118课.txt

    Tableau 数据可视化与实战 118课 课程目录: 第1章: Tableau数据可视化应用实战 1.本门课程目录 2.本门课程目标 3.Tableau概述_什么是数据可视化? 4.Tableau概述_如何用图表讲故事?(1) 5.Tableau概述_Tableau发展...

    Tableau openstreet地图包

    Tableau openstreet地图包 地图包放在安装文件map 文件夹下 使用方法: 地图&gt;&gt;&gt;背景地图&gt;&gt;&gt;autonavi

    tableau公式大全

    Tableau 函数(按字母顺序) 版本: 2018.3 适用于: Tableau Desktop, Tableau Online, Tableau Server 本参考中的 Tableau 函数按字母顺序进行组织。单击某个字母以查看以它开头的函数。如果没有以该字母开头的...

    TableauServer帮助手册

    TableauServer帮助手册,进行TableauServer配置,权限分配等

    Tableau制作仪表盘样式图表

    资源内包含tableau源文件以及制作图表详细步骤文档,有需要的小伙伴欢迎下载使用

    tableau数据源.zip

    Tableau地图数据源,包括autonavi.tms;ESRI Nat Geo World Map;ESRI World Imagery等14个地图数据源,可直接导入tableau地图库中

    触手可及的大数据分析工具_Tableau案例集

    Tableau使用概述包含四章,分别从为何要进行 数据可视化、Tableau的发展历程、Tableau的产品介 绍、Tableau 9.0的新特性、Tableau的应用优势以 及如何利用Tableau进行数据连接和了解工作区几个方面做了详尽的阐述。...

    Tableau商业分析案例数据源

    使用最新的 Tableau 2018.1 版本对分析过程重新截图,而且按照高校的教学目标匹配了案例的广度与深度。书中的案例,部分选自 Tableau 原厂的演示数据,其他绝大多数则由国内的真实案例修改而来。

Global site tag (gtag.js) - Google Analytics