微软应聘的笔试题,哪位大拿帮忙做一下

问题描述

CS25100:DataStructuresandAlgorithms,Spring2011Project3,PatternRecognition--------------------------------------------------------------------------------DescriptionWriteaprogramtorecognizelinepatternsinagivensetofpoints.Computervisioninvolvesanalyzingpatternsinvisualimagesandreconstructingthereal-worldobjectsthatproducedthem.Theprocessisoftenbrokenupintotwophases:featuredetectionandpatternrecognition.Featuredetectioninvolvesselectingimportantfeaturesoftheimage;patternrecognitioninvolvesdiscoveringpatternsinthefeatures.Wewillinvestigateaparticularlycleanpatternrecognitionprobleminvolvingpointsandlinesegments.Thiskindofpatternrecognitionarisesinmanyotherapplications,forexamplestatisticaldataanalysis.Theproblem.GivenasetofNpointsintheplane,draweverylinesegmentthatconnects4ormoredistinctpointsintheset.Bruteforce.WriteaprogramBrute.javathatexamines4pointsatatimeandchecksiftheyalllieonthesamelinesegment,printingoutanysuchlinesegmentstostandardoutputandplottingthemusingstandarddraw.Togetstarted,youmayusethedatatypePoint.javaandtheclientprogramPointPlotter.javawhichreadsinalistofpointsfromstandardinputandplotsthem.YouwillneedtosupplyadditionalmethodsinPoint.javainordertosupportthebrute-forceclient,includingcheckingwhetherthreeorfourpointslieonthesameline.BesuretoimplementatleastthefollowingAPI:publicclassPoint{publicPoint(intx,inty)//constructthepoint(x,y)publicvoiddraw()//drawthispointpublicvoiddrawTo(Pointthat)//drawthelinesegmentfromthispointtothatpointpublicstaticbooleanareCollinear(Pointp,Pointq,Pointr)//arethethreepointscollinear?publicstaticbooleanareCollinear(Pointp,Pointq,Pointr,Points)//arethefourpointscollinear?publicStringtoString()//stringrepresentation}Youwillalsoneedtoaddauser-definedComparatortothePointdatatypeforthesecondpartoftheassignment.Asortingsolution.Remarkably,itispossibletosolvetheproblemmuchfasterthanthebrute-forcesolutiondescribedabove.Givenapointp,thefollowingmethoddetermineswhetherpparticipatesinasetof4ormorecollinearpoints.Thinkofpastheorigin.Foreachotherpointq,determinetheangleitmakeswithp.Sortthepointsaccordingtotheangletheymakeswithp.Checkifany3(ormore)adjacentpointsinthesortedorderhaveequalangleswithp.Ifso,thesepoints,togetherwithp,arecollinear.ApplyingthismethodforeachoftheNpointsinturnyieldsanefficientalgorithmtotheproblem.Thealgorithmsolvestheproblembecausepointsthatmakethesameanglewithparecollinear,andsortingbringssuchpointstogether.Thealgorithmisfastbecausethebottleneckoperationissorting.WriteaprogramFast.javathatimplementsthisalgorithmusingArrays.sort()andauser-definedComparatorforPointobjects.YourprogramshouldusespaceproportionaltoN.Inputformat.ThedatafileconsistsofanintegerN,followedbyNpairsofintegers(x,y),eachbetween0and32,767.%moreinput6.txt%moreinput8.txt6819000100001000001800010000010000320001000030007000210001000070003000123456782000021000140001000030004000140001500060007000Outputformat.Printtostandardoutputthelinesegmentsthatyourprogramdiscoversintheformatbelow(numberofcollinearpointsinthelinesegment,followedbythepointsintheorderinwhichtheyappearonthelinesegment).%javaBrute<input8.txt4:(10000,0)->(7000,3000)->(3000,7000)->(0,10000)4:(3000,4000)->(6000,7000)->(14000,15000)->(20000,21000)%javaFast<input6.txt5:(14000,10000)->(18000,10000)->(19000,10000)->(21000,10000)->(32000,10000)Also,plotthepointsandthelinesegments,usingstandarddraw.(DonotchangethepencolorwithsetPenColor()orthepensizewithsetPenRadius().)UsingthePointdatatypesupplied,p.draw()drawsthepointpandp.drawTo(q)drawsthelinesegmentfromptoq.Beforedrawing,usesetXscale(0,32768)andsetYscale(0,32768)torescalethecoordinatesystem.Forfullcredit,donotprintpermutationsofpointsonalinesegment(e.g.,ifyououtputp→q→r→s,donotalsooutputs→r→q→porp→r→q→s).Also,forfullcreditinFast.java,donotprintorplotsubsegmentsofalinesegmentcontaining5ormorepoints(e.g.,ifyououtputp→q→r→s→t,donotalsooutputp→q→s→torq→r→s→t);youmayprintoutsubsegmentsinBrute.java.YoushouldhaveexactlyonelineofoutputandonecalltodrawTo()foreachlinesegmentdiscovered.ReportSubmitareport(PDFfile)answeringthefollowingquestions:Estimate(usingtildenotation)therunningtime(inseconds)ofyourtwoprogramsasafunctionofthenumberofpointsN.Provideaformalanalysisaboutwhyyouconsidertheformulaprovidediscorrect;youcanuseastylesimilartotheproofsketchformatusedinseveralsectionsofthebook.Show,usingempiricalevidence,theexecutiontimebehaviorofbothversions(bruteVSfast).ProvideatleastaplotandtablewhereyoucomparetherunningtimeobservedfordifferentvaluesofN(forexample,10,20,50,100,200,400,1000,2000,4000,10000,etc).YouareallowedtotestdifferentvaluesofNaslongastheydon'texceedaround200secondsofrunningtime.Thetableshouldcontainthreecolumns:N,brute-forcetimeandfasttime.Theplotshouldhavethex-axisbetheNvalueandthey-axiswillrepresentrunningtimes,whereyouwillshowtwolines(oneforeachversion).EstimatehowlongitwouldtaketosolveaninstanceofsizeN=1,000,000foreachofthetwoalgorithmsusingyourcomputer.SubmissionSubmityoursolutionbeforeFeb2511:59pm.turninwillbeusedtosubmitassignments.Createafolderwhereyouwillincludeallsourcecodeusedandlibrariesinthatfolder.Thereportshouldbeincludedinthatfoldertoo.Finally,provideaREADMEfilewithyourname,instructionstocompileandrunyourcode(Pleasedonotuseabsolutepaths,oratleasttellhowtomodifyittocompilewithoutproblems)andanythingyouwouldlikeustoknowaboutyourprogram(likeerrors,specialconditions,etc).Afterloggingintolore.cs.purdue.edu,pleasefollowthesestepstosubmityourassignment:MakeadirectorynamedyourName_yourSurnameandcopyallofyourfilesthere.Whileintheupperleveldirectory(ifthefilesarein/homes/pangin/pelin_angin,goto/homes/pangin),executethefollowingcommand:%turnin-ccs251-pproject3your_folder_name(e.g.turnin-ccs251-pproject3pelin_angin)Keepinmindthatoldsubmissionsareoverwrittenwithnewoneswheneveryouexecutethiscommand.Youcanverifythecontentsofyoursubmissionbyexecutingthefollowingcommand:%turnin-v-ccs251-pproject3Donotforgetthe-vflaghere,asotherwiseyoursubmissionwouldbereplacedwithanemptyone.BasedonanassignmentdevelopedbyBobSedgewickandKevinWayne.Copyright2008.

解决方案

解决方案二:
该回复于2011-02-17 08:47:26被版主删除
解决方案三:
微软还有Java职位啊
解决方案四:
不知道微软有没有linux的系统管理职位
解决方案五:
你要进微软?
解决方案六:
CS25100:数据结构和算法,2011年春季项目3,模式识别--------------------------------------------------------------------------------说明写一个程序来识别一组给定的点线图案。计算机视觉包括视觉图像分析模式和改造现实世界的对象,产生的数据。这一过程通常分为两个阶段:特征检测和模式识别。特征检测包括选择图像的重要特征;涉及模式识别的特征发现模式。我们将探讨一个特别干净的模式识别问题,涉及点和线段。这种模式识别一种出现在许多其他应用,如统计数据分析。这个问题。给定一个平面上的N点集,每画线段连接的设置4个或更多的不同点。蛮力。写一个程序Brute.java,用于检查的时间和检查,如果他们都在同一线段位于4分,打印出任何线段到标准输出,使用标准的制定策划的。要开始使用,您可以使用数据类型Point.java和客户端程序PointPlotter.java这一个点,从标准输入读取和情节它们的列表。您需要提供在Point.java其他方法,以支持蛮力客户端,包括检查是否三,四点在同一行的谎言。一定要实现至少以下API:公共类点{公共点(智力的x,inty)将//构造的点(x,y)的公共无效的draw()//绘制了这一点公共无效drawTo(点是)//绘制线段从该点到该点公共静态布尔areCollinear(P点,Q点,点R)//是三点共线?公共静态布尔areCollinear(P点,Q点,点R,S点)//是四点共线?公共字符串的toString()//字符串表示}您还需要添加一个用户定义的比较器来点数据的转让第二部分的类型。一个排序的解决方案。值得注意的是,它有可能解决问题的速度远远超过了蛮力解决上文所述。给定一个点P,下列方法确定p是否在4个或更多参与共线点的集合。想想为原点磷。为对方点Q,使得它的角度确定与第排序点,根据他们的角度,使与体育检查是否有3个(或更多)在排序顺序相邻的点有平等的角度与体育如果是这样,这些点,再加上磷,共线。运用这反过来又产生了N点为每个方法一个有效的算法来解决问题。该算法解决了问题,因为点P的提出具有相同的角度共线,并带来了这样的点排序在一起。因为该算法是快速排序操作的瓶颈。写一个程序实现了该算法Fast.java使用Arrays.sort()和一个点对象用户定义的比较。你的程序应该使用空间比例为N输入格式。数据文件包含一个整数N的N对整数(的x,y),其次,在0至32,767元。%以上input6.txt%以上input8.txt6819000100001000000100001800010000320001000030007000210001000070003000123456782000021000140001000030004000140001500060007000输出格式。打印到标准输出线段你的程序在下面的格式发现(共线点的线段在它们的顺序线段上的点出现之后,数字)。%纯Java的野蛮<input8.txt4:(10000,0)->“(7000,3000)->”(3000,7000)“->(0,10000)4:(3000,4000)->“(6000,7000)->”(14000,15000)->“(20000,21000)%的Java快速<input6.txt5:(14000,10000)->“(18000,10000)->”(19000,10000)->“(21000,10000)->”(32000,10000)另外,绘制点和线段,使用标准的制订。(请勿更改与setPenColor()或具有setPenRadius(笔笔的颜色大小)。)使用点数据类型提供,p.draw()绘制和p.drawTo点P(Q)的绘制线段从P到Q在绘制之前,使用setXscale(0,32768)和setYscale(0,32768),以重新调整坐标系统。对于满分,不打印线段上的点的排列(例如,如果你输出P→R的→→q秒,不也输出S→R的→q→p或P→R的→q→s)。此外,在Fast.java满分,不打印或绘制subsegments一行含5分以上(如段,如果你输出P→q→R的→s→吨,不也输出P→q→s→→R的吨或q→s→吨),你可以打印出Brute.javasubsegments。你应该有且只有一个行输出和一个调用drawTo(每个线段)发现。报告提交了一份报告(PDF文件)回答下列问题:估计(使用波浪符号)的运行时间您的两个方案(单位:秒)作为数点全提供一份关于为何你认为该公式提供正式的分析功能是正确的,你可以使用一个风格类似的证明素描格式,用于在该书的几个部分。显示,采用实证的证据,这两个版本(畜生比快)执行时间的行为。提供至少一个情节,你比较表,其中运行时间的N个不同的值(例如,10,20,50,100,200,400,1000,2000,4000,10000等)的观察。你被允许进行测试,只要他们不超过运行时间约200秒N个不同的值。该表应包含三个列:氮,蛮力时间和快速的时间。该地块应具有的X轴是N值和Y轴的运行时间将代表,在这里您将显示两行(每一个版本)。估计将需要多长时间来解决这两个使用您的计算机算法每一个大小为N=1,000,000实例。提交提交您的解决方案之前,2月25日晚上11:59。撇开将用于提交任务。创建一个文件夹,您将包括所有源代码中使用,并在该文件夹库。该报告应包括在该文件夹了。最后,提供您的姓名README文件,指示来编译和运行代码(请不要使用绝对路径,或者至少告诉如何修改它来编译没有问题)和任何你希望我们了解你的程序(如错误,特殊条件等)。项目建成后lore.cs.purdue.edu记录,请按照下列步骤提交您的作业:建立一个目录名为yourName_yourSurname和复制你的文件都在那里。而在上一级目录(如果该文件在/家庭/pangin/pelin_angin,转到/家庭/pangin中),执行以下命令:%撇开-C的cs251-P的project3your_folder_name(如撇开-C的cs251-P的project3pelin_angin)请记住,每当老意见书与执行此命令的新的覆盖。您可以通过执行以下命令您提交的内容:%撇开-V的-C的cs251-P的project3不要忘了-v标志在这里,否则您的提交将与一空一所取代。根据由Bob塞奇威克和凯文韦恩开发的任务。版权所有2008。
解决方案七:
难道微软又要收购ORACLE?
解决方案八:
微软又要收购ORACLE?????怎么可能呢
解决方案九:
引用3楼knightzhuwei的回复:

不知道微软有没有linux的系统管理职位

应该有的,微软好像有专门研究Linux的部门,还贡献Linux内核代码来着。
解决方案十:
5楼的,您这翻译也翻译得太全了吧,类名和类方法都让您给翻译了引用5楼woshigaoshou980的回复:

排序点,根据他们的角度,使与体育检查是否有3个(或更多)在排序顺序相邻的点有平等的角度与体育如果是这样

估计中国人都看不懂,怎么和体育扯上关系了。
解决方案十一:
这难道是c#冒充java?
解决方案十二:
一个朋友说,他应聘微软给的题目,他是学c的,不知为什么这样考,让我帮忙。大家有什么想法没。

时间: 2024-08-31 18:03:55

微软应聘的笔试题,哪位大拿帮忙做一下的相关文章

java 笔试题-微软4月笔试题第二题,为什么本地运行没错,提交是RE,实在想不出来,求救!!

问题描述 微软4月笔试题第二题,为什么本地运行没错,提交是RE,实在想不出来,求救!! import java.util.ArrayList; import java.util.Scanner; public class Main { int allowS = 0;//rules allow数组大小 int denyS = 0; ArrayList<String> allow = new ArrayList<>();//用来存放动态变化的rules,整个类都要使用,则定义为实例变量

jsp-求教:哪位大神帮忙看下代码,本人小白,实在不知道哪里有问题!!

问题描述 求教:哪位大神帮忙看下代码,本人小白,实在不知道哪里有问题!! 代码如下,登陆页面,把java逻辑放到了后台页面上,运行的时候没有报错,但是不跳转.测试账号密码正确不跳转因为没写,但是测试账号密码错误的情况下也不跳转. <%@ page language=""java"" import=""java.util.*java.sql.*info.DataBase"" pageEncoding=""

表单-php数据插入问题,哪位大神帮忙看看

问题描述 php数据插入问题,哪位大神帮忙看看 2C 招商页面测试 <?php if(!isset($_POST['submit'])){ //如果没有表单提交,显示一个表单 ?> 请输入姓名: 请输入电话: 请确认城市: 请输入邮箱: <?php } else { //如果提交了表单 //数据库连接参数 $host = ""localhost""; $user = ""root""; $pass = &qu

struts-这个怎么弄啊,哪位大神帮忙看看

问题描述 这个怎么弄啊,哪位大神帮忙看看 解决方案 在Eclipse中,把Server下配置的项目全部删除,然后重新运行这个项目,试试 解决方案二: 请大神帮忙看看啊 怎么回事啊 解决方案三: serve是这个吗,亲 . 链接:http://pan.baidu.com/s/1pLKO1qb 密码:eu3b

Navicat出现这个报错 哪位大神帮忙看下

问题描述 Navicat出现这个报错 哪位大神帮忙看下 今天重装了C盘之后 打开navicat就这样了 本人小白 不明白这个报错是什么意思 解决方案 是我的mysql出现问题了吗 如果是 我已经重新安装mysql好几次了 还是有这样的错误 不明白 解决方案二: 没遇到过这问题,度娘吧

ios开发-iOS跑项目时出错,哪位大神帮忙解答

问题描述 iOS跑项目时出错,哪位大神帮忙解答 could not cast value of type 'UIViewController' to 'todolist.ViewController'

java-谷歌面试题,求大神帮忙

问题描述 谷歌面试题,求大神帮忙 原题是这样的(后面我补充了中文解释): Don't mind the map After the trauma of Dr. Boolean's lab, the rabbits are eager to get back to their normal lives in a well-connected community, where they can visit each other frequently. Fortunately, the rabbits

c语言-哪位大神能帮忙解释一下这下面的迷宫随机生成函数吗?

问题描述 哪位大神能帮忙解释一下这下面的迷宫随机生成函数吗? void create(int xint y) //随机生成迷宫{ int c[4][2]={01100-1-10}; //四个方向 int ijt; //将方向打乱 for(i=0;i<4;i++) { j=rand()%4;//随机生成函数,这里的作用是随机生成j t=c[i][0];c[i][0]=c[j][0];c[j][0]=t; t=c[i][1];c[i][1]=c[j][1];c[j][1]=t; } map[x][y

请哪位大神帮忙解决下这个问题-内存泄露

问题描述 请哪位大神帮忙解决下这个问题-内存泄露 请哪位大神帮忙解决下这个问题,实在是找不到哪个地方内存泄露,凡是代码中用到new的,我都delete了... Detected memory leaks! Dumping objects -> {107} normal block at 0x00206188, 21 bytes long. Data: < l| > A8 6C 7C 00 04 00 00 00 04 00 00 00 01 00 00 00 {106} normal b