



全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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导游证资格考试文化常识试题及答案
- 2024年营养师资格证易错试题与答案解析
- 营养师考试实战经验及试题答案
- 2024年常见饮食误区试题及答案
- 2024营养师考试体验题及答案
- 演出经纪人资格证多层次解析
- 新人教版英语五年级下册教材解读
- 【课件】跨学科实践:探索厨房中的物态变化问题+课件人教版(2024)物理八年级上册
- 环磷酰胺的护理
- 江西省第一届职业技能大赛分赛场项目技术文件(世赛选拔)轨道车辆技术
- HGT 6342-2024《工业用甲基四氢苯酐》
- 排水管网维护、维修施工方案
- DB32-T 2882-2016城市轨道交通桥隧结构养护技术规程
- 2024年北京市丰台区九年级中考复习一模数学试卷含答案
- 峰峰城区规划方案
- 2022年4月自考04851产品设计程序与方法试题及答案含解析
- 隧道工程施工组织设计方案
评论
0/150
提交评论