一、填空

侧重逻辑思维,没有语言、具体技术考察,大部分属于组合数学、算法。比较基本的知识点有二元树节点树、最小生成树、Hash函数常用方法等。

二、编程题

1、正整数剖分

2、AOE关键路径

3、二元树前序、中序求后序

4、大整数加

//正整数剖分
#include <stdio.h> int func(int n, int k, int max)
{
int min = (int)((n+k-)/k);
if(k==)
return ;
int count = ;
for(int i=min;i<max;i++){
count += func(n-i, k-, max-i);
}
return count;
} int main()
{
int ans;
int i = ;
//ans = func(10, 3, 10);
ans = func(, , );
printf("%d\n", ans); return ;
}
//AOE
#include <stdio.h>
#include <stdlib.h>
#include <string.h> void AOE(int adj[][], int n)
{
int *e = (int*)malloc(sizeof(int)*n);
int *l = (int*)malloc(sizeof(int)*n);
e[]=;
for(int i=;i<n;i++){
int max = ;
for(int j=;j<i;j++){
if(adj[j][i]!= && adj[j][i]+e[j]>max){
max = adj[j][i] + e[j];
}
}
e[i]=max;
}
l[n-]=e[n-];
for(int i=n-;i>=;i--){
int min = ;
for(int j=n-;j>i;j--){
if(adj[i][j]!= && l[j]-adj[i][j]<min){
min = l[j]-adj[i][j];
}
}
l[i]=min;
}
for(int i=;i<n;i++){
if(e[i]==l[i])
printf("%d\t", i+);
}
printf("\n");
free(e);
free(l);
}
int main()
{
const int size = ;
int adj[size][size];
memset(adj, , sizeof(int)*size*size);
adj[][] = , adj[][]=, adj[][]=;
adj[][] = , adj[][]=, adj[][]=;
adj[][] = , adj[][]=, adj[][]=;
adj[][] = , adj[][]=; AOE(adj, size); return ;
}
//二元树前序、中序打印后序
#include <stdio.h>
#include <cstring>
#include <stack>
using namespace std;
void dumpPost(const char* pre, const char* mid)
{
int n = strlen(pre);
if(n==){
printf("%c\t", pre[]);
return;
}
int i;
for(i=;i<n;i++){
if(mid[i]==pre[])
break;
}
char lpre[i], lmid[n-i-];
char rpre[i], rmid[n-i-];
memcpy(lpre, pre+, sizeof(char)*i);
memcpy(lmid, mid, sizeof(char)*i);
memcpy(rpre, pre+i+, sizeof(char)*(n-i-));
memcpy(rmid, mid+i+, sizeof(char)*(n-i-));
lpre[i] = lmid[i] = '\0';
rpre[n-i-] = rmid[n-i-] = '\0';
dumpPost(lpre, lmid);
dumpPost(rpre, rmid);
printf("%c\t", pre[]);
}
int main()
{
const char* preOrder = "ABDEC";
const char* midOrder = "DBEAC";
const char* postOrder = "DEBCA"; dumpPost(preOrder, midOrder);
printf("\n"); return ;
}
//大整数运算
#include <stdio.h>
#include <stdlib.h>
#include <string.h> void strrev(char* s)
{
int i=-;
while(s[++i]!='\0');
for(int j=;j<i/;j++){
char tmp = s[j];
s[j] = s[i-j-];
s[i-j-]=tmp;
}
}
void Add(const char*str1, const char* str2, char* ans)
{
int l1, l2, l;
l1 = strlen(str1);
l2 = strlen(str2);
l = l1>l2 ? l1 : l2;
char* s1 = (char*)malloc(sizeof(char)*(l1+));
char* s2 = (char*)malloc(sizeof(char)*(l2+));
memcpy(s1,str1,(l1+)*sizeof(char));
memcpy(s2,str2,(l2+)*sizeof(char));
strrev(s1);
strrev(s2);
int i;
int sum, carry;
i=sum=carry=;
while(i<l){
char a = i<l1?s1[i]:'';
char b = i<l2?s2[i]:'';
sum = a-''+b-'' + carry;
ans[i] = sum % + '';
carry = sum / ;
i++;
}
if(carry!=)
ans[i++]=carry+'';
ans[i]='\0';
strrev(ans);
free(s1);
free(s2);
}
void Mul(const char*str1, const char* str2, char* ans)
{
int l1, l2, l;
l1 = strlen(str1);
l2 = strlen(str2);
l = l1 + l2;
ans[]='\0';
char* s1 = (char*)malloc(sizeof(char)*(l1+));
char* s2 = (char*)malloc(sizeof(char)*(l2+));
memcpy(s1,str1,(l1+)*sizeof(char));
memcpy(s2,str2,(l2+)*sizeof(char));
strrev(s1);
strrev(s2);
char* tmp = (char*)malloc(sizeof(char)*(l1+));
int s, carry;
s = carry = ;
for(int i=;i<l2;i++){
int j;
for(int j=;j<i;j++)
tmp[j]='';
for(j=;j<l1;j++){
s = (s1[j]-'')*(s2[i]-'')+carry;
tmp[i+j]=s%+'';
carry=s/;
}
if(carry!=)
tmp[i+j++]=carry+'';
tmp[i+j]='\0';
strrev(ans);
strrev(tmp);
Add(ans,tmp, ans);
strrev(ans);
}
strrev(ans);
}
int main()
{
const char a[] = "";
const char b[] = "";
char c[]; Add(a,b,c);
printf("a+b=%s\n", c);
Mul(a,b,c);
printf("a*b=%s\n", c); return ;
}

2012Hulu校园招聘笔试题的更多相关文章

  1. 2014 WAP校园招聘笔试题

    2014 WAP校园招聘笔试题 Problem's Link:   http://www.doc88.com/p-6751117015483.html WAP公司笔试题 We are planning ...

  2. google2013校园招聘笔试题(全国)

    google2013校园招聘笔试题 1. 单项选择题1.1如果把传输速率定义为单位时间内传送的信息量(以字节计算)多少.关于一下几种典型的数据传输速率:1.使用USB2.0闪存盘,往USB闪存盘上拷贝 ...

  3. Microsoft 2013校园招聘笔试题及解答

    Microsoft 2013校园招聘笔试题及解答 题目是自己做的,求讨论.吐槽.拍砖 1.      Which of the following callingconvension(s) suppo ...

  4. Microsoft2013校园招聘笔试题

    Microsoft2013校园招聘笔试题 继续求拍砖!!!! 1. You are managing the database of a book publichser, you currently ...

  5. C# - 2017微软校园招聘笔试题 之 MS Recognition[待解决]

    MS Recognition 在线提交: hihoCoder 1402 http://hihocoder.com/problemset/problem/1402 类似: OpenJudge - I:P ...

  6. 京东2017校园招聘笔试题 【第K个幸运数】

    题目描述 4和7是两个幸运数字,我们定义,十进制表示中,每一位只有4和7两个数的正整数都是幸运数字. 前几个幸运数字为:4,7,44,47,74,77,444,447... 现在输入一个数字K,输出第 ...

  7. 九度OJ 1531 货币面值(网易游戏2013年校园招聘笔试题) -- 动态规划

    题目地址:http://ac.jobdu.com/problem.php?pid=1531 题目描述: 小虎是游戏中的一个国王,在他管理的国家中发行了很多不同面额的纸币,用这些纸币进行任意的组合可以在 ...

  8. PPS2013校园招聘笔试题

    转载请标明出处,原文地址:http://blog.csdn.net/hackbuteer1/article/details/11473405 一.简答题 (1)一位老师有2个推理能力很强的学生,他告诉 ...

  9. Microsoft2013校园招聘笔试题及解答

    继续求拍砖!!!! 1. You are managing the database of a book publichser, you currently store the book orders ...

随机推荐

  1. cent os 6.5 配置vsftpd

    1. 下载vsftpd: #yum –y install vsftpd 2. 关闭iptables 查看防火墙状态:/etc/init.d/iptables status 关闭:service ipt ...

  2. hbase操作

    名称命令表达式 创建表create '表名称','列簇名称1','列簇名称2'....... 添加记录put '表名称', '行名称','列簇名称:','值' 查看记录get '表名称','行名称' ...

  3. Gluster vs Ceph:开源存储领域的正面较量

    https://www.oschina.net/news/49048/gluster-vs-ceph 引言:开源存储软件Ceph和Gluster能够提供相似的特性并且能够为用户节省不小的开支.那么谁更 ...

  4. DCOS :私有云的物理基础架构管理引擎

    https://cloud.tencent.com/developer/article/1005598 一.引言 云计算经过多年的发展,逐渐从概念到渐为人认知.到接受.到现在全行业拥抱上云,云的客户也 ...

  5. Asp.net Core 项目API接口服务器部署

    Windows server 2008服务器部署: DotNetCore.1.0.0.RC2-WindowsHosting 或者DotNetCore.1.0.5_1.1.2-WindowsHostin ...

  6. tensorflow笔记1:基础函数、embedding_lookup

    函数一:tf.nn.embedding_lookup() ERROR: I get this error: TypeError: Tensors in list passed to 'values' ...

  7. uwsgi -- unavailable modifier requested: 0 -- 的解决办法

    nginx 报错 upstream prematurely closed connection while reading response header from upstream 说明是上游服务器 ...

  8. DIOCP3-数据库DEMO

    socket-Coder\DataModuleDEMO\   本DEMO演示数据库的简单使用,其他功能需要自己扩展.   将工程的输出路径设置到socket-Coder\DataModuleDEMO\ ...

  9. Unique constraint on single String column with GreenDao2

    转:http://software.techassistbox.com/unique-constraint-on-single-string-column-with-greendao_384521.h ...

  10. 让mysql查询强制走索引

    select * from slot_value_temp force index(idx_slot_type_id) WHERE slot_type_id = 'xxxxxx'; 不定期更新