ImageVerifierCode 换一换
格式:DOCX , 页数:36 ,大小:37.98KB ,
资源ID:7767380      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/7767380.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(Interview+Question+Answers.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

Interview+Question+Answers.docx

1、Interview+Question+AnswersReverse a Singly Linked List without using Recursion. / / Revert a single linked list / / a single linked list / a single linked list public static SingleLinkedListNode Reverse(SingleLinkedListNode root) if (root = null) throw new ArgumentNullException(root); SingleLinkedLi

2、stNode iter = root, next = root.Next; SingleLinkedListNode newRoot = root; root.Next = null; while (next != null) newRoot = next.Next; next.Next = iter; iter = next; next = newRoot; return iter; Reverse a Singly Linked List with using Recursion.编程找出N以下的所有素数void findPrimes(bignum topCandidate) bignum

3、 candidate = 2; while(candidate = topCandidate) bignum trialDivisor = 2; int prime = 1; while(trialDivisor * trialDivisor 0) & char.IsWhiteSpace(inputlastIndex - 1) lastIndex-;9. 10. int appendIndex = 0;11. for (int i = lastIndex - 1; i = 0; i-)12. 13. char c = inputi;14. / if (char.IsWhiteSpace(inp

4、uti)15. if ( c = | c = t | c = n | c = r )16. 17. for (int j = i + 1; j lastIndex; +j)18. sbappendIndex+ = inputj;19. 20. sbappendIndex+ = inputi;21. lastIndex = i;22. 23. 24. 25. for (int j = 0; j lastIndex; +j)26. sbappendIndex+ = inputj;27. 28. return new string(sb);29. Write a function that take

5、s in a string parameter and checks to see whether or not it is an integer, and if it is then return the integer value.1. public static int Parse(string args)2. 3. / Author: Yimin Shi. 2008-05-304. / 这个函数也有一个BUG, 比如在处理字符串 -5147483648时候,就不会throw OverflowException.5. if (string.IsNullOrEmpty(args)6. th

6、row new ArgumentNullException(args);7. 8. int iter = 0;9. bool bNegative = false;10. int result = 0;11. / Skip whites 12. while (iter args.Length & (argsiter = ) iter+;13. 14. if (argsiter = -)15. 16. bNegative = true;17. iter+;18. 19. else if (argsiter = +)20. iter+;21. 22. for (; iter = 0 & argsit

7、er = 9)25. 26. int cur = argsiter - 0; 32. 33. checked(result *= 10);34. 35. result = bNegative ? result - cur36. : result + cur;42. 43. else44. break;45. 46. 47. / Skip whites 48. while (iter args.Length & (argsiter = ) iter+;49. if (iter != args.Length)50. throw new ArgumentException();51. 52. ret

8、urn result;53. Implement strstr() (or some other string library function).char * _cdecl strstr ( const char * str1, const char * str2 ) char *cp = (char *) str1; char *s1, *s2; if ( !*str2 ) return(char *)str1); while (*cp) s1 = cp; s2 = (char *) str2; while ( *s1 & *s2 & !(*s1-*s2) ) s1+, s2+; if (

9、!*s2) return(cp); cp+; return(NULL);Implement an algorithm to print out all files below a given root node.public abstract class AbstractGraph : AbstractContainer, Graph protected int numberOfVertices; protected int numberOfEdges; protected Vertex vertex; public void BreadthFirstTraversal( Visitor vi

10、sitor, int start) bool enqueued = new boolnumberOfVertices; for (int v = 0; v numberOfVertices; +v) enqueuedv = false; Queue queue = new QueueAsLinkedList(); queue.Enqueue(vertexstart); enqueuedstart = true; while (!queue.IsEmpty & !visitor.IsDone) Vertex v = (Vertex)queue.Dequeue(); visitor.Visit(v

11、); foreach (Vertex to in v.Successors) if (!enqueuedto.Number) queue.Enqueue(to); enqueuedto.Number = true; 现有一单链表,输出从尾端开始的第5个数值,并写出相应的测试用例Given two linked lists which have data in ascending order, how would you merge them/ / Merge two sorted linked list in sorted order / / the first sorted linked l

12、ist / the second sorted linked list / / The result sorted linked list / / For e.g. / SingleLinkedListNode.PrintLinkedList(SingleLinkedListNode.OrderedMerge(SingleLinkedListNode.InitializeTestList(new int 1, 2, 4, 5, 6, 7, 8, 9 ), SingleLinkedListNode.InitializeTestList(new int 3, 6, 8, 9, 10 ); / -

13、returns - / 1 - 2 - 3 - 4 - 5 - 6 - 6 - 7 - 8 - 8 - 9 - 9 - 10 - / / SingleLinkedListNode.PrintLinkedList(SingleLinkedListNode.OrderedMerge(SingleLinkedListNode.InitializeTestList(new int 1, 2, 4, 5, 7 ), SingleLinkedListNode.InitializeTestList(new int 3, 6, 8, 9, 10 ); / - returns - / 1 - 2 - 3 - 4

14、 - 5 - 6 - 7 - 8 - 9 - 10 - / public static SingleLinkedListNode OrderedMerge(SingleLinkedListNode first, SingleLinkedListNode second) if (first = null) throw new ArgumentNullException(first); if (second = null) throw new ArgumentNullException(second); SingleLinkedListNode less = first.Value second.

15、Value ? first : second; SingleLinkedListNode newRoot = less; SingleLinkedListNode iter = newRoot; less = less.Next; while (less != null & larger != null) if (less.Value larger.Value) iter.Next = less; less = less.Next; else iter.Next = larger; larger = larger.Next; iter = iter.Next; while (less != n

16、ull) iter = iter.Next = less; less = less.Next; while (larger != null) iter = iter.Next = larger; larger = larger.Next; return newRoot; Implement an algorithm to do wild card string matching.1. private static bool WildCardMatch(string pattern, string input)2. 3. if (string.IsNullOrEmpty(pattern)4. t

17、hrow new ArgumentNullException(pattern);5. if (string.IsNullOrEmpty(input)6. throw new ArgumentNullException(input);7. 8. int inputIter = 0;9. int patternIter = 0;10. for (; patternIter pattern.Length; +patternIter)11. 12. if (patternpatternIter = *)13. 14. while (patternIter pattern.Length - 1) & (

18、patternpatternIter + 1 = *) patternIter+;15. if (patternIter = pattern.Length - 1)16. return true;17. 18. while (patternIter pattern.Length) &19. (inputIter = input.Length) break;28. 29. if (patternpatternIter != inputinputIter+)30. return false;31. 32. 33. 34. return patternIter = pattern.Length &

19、inputIter = input.Length;35. Write a routine that prints out a 2-D array in spiral order! int left=0,top=0,right=3,bottom=3,CurrentRow=0,CurrentCulom=0,step; int, Num = new int, 1, 2, 3,4 , 5, 6 ,7,8, 9,10,11,12 , 13,14,15,16 ; /rule define:X,Y,if X=0,traversal colum,if X=1,traversal row;if Y=1,incr

20、ease by degrees,if Y=-1,decrease by degrees /int, rule = new int, 1, 1 , 0, 1 , 1, -1 , 0, -1 ;/clockwise int, rule = new int, 0, 1 , 1, 1 , 0, -1 , 1, -1 ; /counter-clockwise int a = Num.Rank; int b = Num.Length; int process=0; while (true) switch (ruleprocess, 0) case 1:/row step = ruleprocess, 1;

21、 for (; CurrentCulom = left & CurrentCulom = top & CurrentRow bottom | left right) break; process =( process + 1) % 4; Implement a string.Replace.1. public static string Replace(string strSrc, string oldStr, string newStr)2. /Implement a string.Replace.3. 4. if (string.IsNullOrEmpty(strSrc) | string.IsNullOrEmpty(oldStr) | newStr = null)5. throw

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1