Micosoft招聘部分算法题

Micosoft招聘部分算法题

1.链表和数组的区别在哪里?

2.编写实现链表排序的一种算法。说明为什么你会选择用这样的方法?

3.编写实现数组排序的一种算法。说明为什么你会选择用这样的方法?

4.请编写能直接实现strstr()函数功能的代码。

5.编写反转字符串的程序,要求优化速度、优化空间。

6.在链表里如何发现循环链接?

7.给出洗牌的一个算法,并将洗好的牌存储在一个整形数组里。

8.写一个函数,检查字符是否是整数,如果是,返回其整数值。(或者:怎样只用4行代码编写出一个从字符串到长整形的函数?)

9.给出一个函数来输出一个字符串的所有排列。

10.请编写实现malloc()内存分配函数功能一样的代码。

11.给出一个函数来复制两个字符串A和B。字符串A的后几个字节和字符串B的前几个字节重叠。

12.怎样编写一个程序,把一个有序整数数组放到二叉树中?
13.怎样从顶部开始逐层打印二叉树结点数据?请编程。
14.怎样把一个链表掉个顺序(也就是反序,注意链表的边界条件并考虑空链表)?

来源:·日月光华 bbs.fudan.edu.cn

Similar Posts

  • MFC程序使用系统风格界面

    VC6默认编译出来的程序在XP下Luma风格下运行也是Windows的经典界面, 有损界面的美观与统一. VC2008默认设置下如果不是使用的unicode也是如此. 本文给出使VC6和VC2008可以编译出使用系统界面风格的解决方案. 1. 使VC6编译出使用系统风格的程序 步骤如下: 1) 创建一个.manifest文件的资源. 在res/文件夹下创建一个跟以程序名加.manifest的文件, 如果程序为test.exe, 则创建test.exe.manifest 文件可由此下载: https://www.systutorials.com/t/g/programming/resultcollector.manifest/ 注意要使用utf-8编码保存。 2) 将新定义的资源加入到.rc2文件中, 类型设为24. 打开res/文件夹下的.rc2文件, 在其中加入如下定义: 1 24 MOVEABLE PURE “res/test.exe.manifest” 其中的文件地址按1)步中修改的设置即可. 之后编译即可, 为了使程序界面可能充分利用系统的界面特性, 可以将界面字体设置为TrueType类型的, 利用Windows XP等系统的屏幕字体平滑特性. 2. 使VC2008编译出使用系统风格的程序 在VC2008下就比较简单了, 如果程序字符集使用unicode则默认就是使用系统界面风格的, 如果选择其它的类型, 则编辑下stdafx.h即可. 最后面部分找到这么一段: #ifdef _UNICODE #if defined _M_IX86 #pragma comment(linker,”/manifestdependency:”type=’win32′ name=’Microsoft.Windows.Common-Controls’ version=’6.0.0.0′ processorArchitecture=’x86′ publicKeyToken=’6595b64144ccf1df’ language=’*'””) #elif defined _M_IA64 #pragma comment(linker,”/manifestdependency:”type=’win32’…

  • How to get the hostname of the node in Python?

    In Python, how to get the hostname of the node? In Python, you can get the hostname by the socket.gethostname() library function in the socket module: import socket hostname = socket.gethostname() Example: $ python Python 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2 Type “help”, “copyright”, “credits” or “license”…

  • |

    Sorting Two Lists Together According to The Order of One List in Python

    We may use two lists to store the values of two properties of a list of elements in Python. Under such data structure arrangement, when we need to sort the properties from one list, we may want to also make sure the other list will be also re-ordered following the same order as the first…

  • |

    Vim Indenting C/C++ Code

    Vim provides some basic formatting commands. A combination of these commands with the editing commands will make the programmer happy. A list of basic text formatting commands in Vim: = is an operator that formats/indents text. i{ is a text object that specifies the surrounding code block. It should be used together with v, =,…

Leave a Reply

Your email address will not be published. Required fields are marked *