上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 49 下一页

2014年11月9日

Merge Two Sorted Lists

摘要: 归并两个有序序列为一个有序序列Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the n... 阅读全文

posted @ 2014-11-09 16:09 luckygxf 阅读(137) 评论(0) 推荐(0)

Binary Tree Level Order Traversal

摘要: Binary Tree Level Order TraversalGiven a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).Fo... 阅读全文

posted @ 2014-11-09 15:23 luckygxf 阅读(172) 评论(0) 推荐(0)

Binary Tree Level Order Traversal II

摘要: 这道题A的略烦Binary Tree Level Order Traversal IIGiven a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right... 阅读全文

posted @ 2014-11-09 14:19 luckygxf 阅读(170) 评论(0) 推荐(0)

图和图的遍历算法

摘要: 图和图的遍历算法1.存储结构(邻接链表)1.1每个顶点用VexNode类表示,每条边用ArcNode表示1.2所有顶点用数组VexNode adjlist[]表示,所有邻接顶点用链表表示2.遍历算法2.1深度优先遍历DFS用递归实现,从V0开始,访问V0即邻接顶点V1,访问V1及其邻接顶点...2.... 阅读全文

posted @ 2014-11-09 12:47 luckygxf 阅读(635) 评论(0) 推荐(0)

2014年11月8日

Remove Duplicates from Sorted List

摘要: Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, r... 阅读全文

posted @ 2014-11-08 23:38 luckygxf 阅读(130) 评论(0) 推荐(0)

Binary Tree Preorder Traversal

摘要: Binary Tree Preorder TraversalGiven a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ... 阅读全文

posted @ 2014-11-08 23:02 luckygxf 阅读(122) 评论(0) 推荐(0)

Merge Sorted Array

摘要: Merge Sorted ArrayGiven two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that i... 阅读全文

posted @ 2014-11-08 15:53 luckygxf 阅读(184) 评论(0) 推荐(0)

2014年11月7日

Same Tree

摘要: Same TreeGiven two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally ide... 阅读全文

posted @ 2014-11-07 23:44 luckygxf 阅读(150) 评论(0) 推荐(0)

归并排序

摘要: 归并排序1.将两个有序序列归并成一个有序序列2.将带排序数组,通过递归调整成左右两个有序序列,在调用归并算法,将其归并成一个有序序列,完成排序Merg.java 1 package com.gxf.merg; 2 3 /** 4 * 归并排序 5 * 初始状态,将数组看成n个单独有序的序列,两... 阅读全文

posted @ 2014-11-07 23:38 luckygxf 阅读(180) 评论(0) 推荐(0)

Maximum Depth of Binary Tree

摘要: Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root ... 阅读全文

posted @ 2014-11-07 00:09 luckygxf 阅读(125) 评论(0) 推荐(0)

上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 49 下一页

导航