全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 【智慧养老】养老社区视频监控与异常行为自动识别系统解决方案
- 2026年新课标II卷生物细胞器功能基础预测卷含解析
- 渣土运输安全工作总结
- 国际商务-杨恺钧
- 2026年新高考全国卷三生物易错知识点专项卷含解析
- 2026年新课标II卷高考化学押题卷预测专题突破冲刺卷(含解析)
- 高中地理必修二课件 22湿地资源的开发与保护
- 2026年新高考化学全国卷三模拟考试预测卷(含解析)
- 化工过滤工风险评估与管理能力考核试卷含答案
- 爆破工安全培训水平考核试卷含答案
- 养老社区2025年定位手环协议
- 2026云南楚雄州武定县事业单位选调37人备考题库及答案详解(真题汇编)
- 高中政治必修+选必核心答题术语(简化版)
- 经典酒店设计案例分析
- 22G101 混凝土结构施工图 平面整体表示方法制图规则和构造详图(现浇混凝土框架、剪力墙、梁、板)
- P-III曲线水文频率计算电子表格程序
- 《医疗机构病历管理规定(2025年版)》
- 放射药物标记-洞察及研究
- 2025年江苏事业单位招聘考试综合类结构化面试真题试卷及答案解析
- 校园互助平台创业计划
- 建筑工程英语英汉对照工程词汇
评论
0/150
提交评论