全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1. Algorithms* Whats the difference between a linked list and anarray?Statically dynamicallySize is pre-definedStorage:continuousPeformance:* Implement an algorithm to sort a linked list. Why did you pick the method you did?Quicksort,mergesort* Implement an algorithm to sort an array. Why didyou pick the method you did?* Implement strstr() (or some other string libraryfunction).* Reverse a string. Optimize for speed. Optimize forspace.* Count the number of set bits in a number. Now optimize for speed. Now optimize for size.* How would you find a cycle in a linked list?* Give me an algorithm to shuffle a deck of cards,given that the cards are stored in an array of ints.* Write a function that takes in a string parameterand checks to seewhether or not it is an integer, and if it is then return theintegervalue.* Write a function to print all of the permutationsof a string.* Implement malloc.* Write a function to print the Fibonacci numbers.* Write a function to copy two strings, A and B. Thelast few bytes of string A overlap the first few bytes of string B.* How would you print out the data in a binary tree,level by level, starting at the top?2. Applications* How can computertechnology be integrated in anelevator system for a hundred storyoffice building? How do you optimize foravailability? How wouldvariation of traffic over a typical work week or flooror time of dayaffect this?* How would you redesign an ATM?* Suppose we wanted to run a microwave oven from thecomputer. What kind of software would you write to do this?* How would you design a coffee-machine for anautomobile.3. Thinkers* How are M&Ms made?* If you had to learn a new computer language, howwould you go about doing it?* If MS told you we were willing to invest million ina start up of your choice, what business would you start? Why?* If you could gather all of the computermanufacturers in the worldtogether into one room and then tell them one thingthat they would becompelled to do,what would it be?* Explain a scenario for testing a salt shaker.* If you are going to receive an award in 5 years,what is it for and who is the audience?* How would you explain how to use Microsoft Excel toyour grandma?* Why is it that when you turn on the hot water inany hotel, forexample, the hot water comes pouring out almost instantaneously?Difference between the malloc() and the calloc()Both the malloc() and the calloc() functions are used to allocate dynamic memory. Each operates slightly different from the other.Both the malloc() and the calloc() functions are used to allocate dynamic memory. Each operates slightly different from the other.malloc() takes a size and returns a pointer to a chunk of memory at least that big:void *malloc( size_t size );calloc() takes a number of elements, and the size of each, and returns a pointer to a chunk of memoryat least big enough to hold them all:void *calloc( size_t numElements, size_t sizeOfElement );There are one major difference and one minor difference between the two functions.The major difference is that malloc() doesnt initialize the allocated memory.The first time malloc() gives you a particular chunk of memory, the memory might be full of zeros.If memory has been allocated, freed, and reallocated, it probably has whatever junk was left in it.That means, unfortunately, that a program might run in simple cases (when memory is never reallocated) but break when used harder (and when memory is reused).calloc() fills the allocated memory with all zero bits.That means that anything there you are going to use as a char or an int of any length, signed or unsigned, is guaranteed to be zero.Anything you are going to use as a pointer is set to all zero bits.That is usually a null pointer, but it is not guaranteed.Anything you are going to use as a float or double is set to all zero bits; that is a floating-point zero on some types of machines, but not on all.The minor difference between the two is that calloc() returns an array of objects; malloc() returns one object.Some people
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025江西洪城水业环保有限公司招聘工勤岗工作人员28人笔试历年常考点试题专练附带答案详解
- 2025山东青岛海明城市发展有限公司及全资子公司第三批招聘进行笔试历年典型考点题库附带答案详解
- 道路土方施工与质量验收方案
- 2026江苏南京工业大学教学科研岗招聘101人备考题库及1套完整答案详解
- 2026浙江嘉兴市海宁许村中心卫生院招聘1人备考题库及答案详解【新】
- 2026绵阳科达人才安居有限责任公司员工招聘1人备考题库及参考答案详解(模拟题)
- 2026年及未来5年市场数据中国小程序电商应用行业市场全景监测及投资前景展望报告
- 2025年功能性食品创新趋势报告
- 接触网工安全宣贯测试考核试卷含答案
- 桥梁支座安装专项施工方案
- 气象灾害防御工作制度
- 简阳市投资促进局公开招聘编外人员考试备考试题及答案解析
- 2026年生物制药(生物制药技术)试题及答案
- 2026年广西机场管理集团有限责任公司校园招聘考试模拟试题及答案解析
- 2025年全国高校辅导员考试练习题及答案
- PEP人教版六年级下册英语教案全册
- 江西省重点中学协作体2026届高三下学期第一次联考英语试卷(不含音频及听力原文答案不全)
- 2026校招:上海银行笔试题及答案
- 陕西省测绘成果保密制度
- 内部风险隐患报告奖励制度
- 2026年安全生产网格化测试题及答案
评论
0/150
提交评论