随笔分类 -  数据结构

leetcode 88 Merge Sorted Array
摘要:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size tha 阅读全文
posted @ 2018-03-16 14:58 gtxvs 阅读(157) 评论(0) 推荐(0)
leetcode 94 Binary Tree Inorder Traversal
摘要:Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree [1,null,2,3], return [1,3,2]. 用的递归方法,提示上说递归方法太普通 阅读全文
posted @ 2018-03-16 00:11 gtxvs 阅读(131) 评论(0) 推荐(0)
leetcode 100. Same Tree
摘要:Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident 阅读全文
posted @ 2018-03-14 22:29 gtxvs 阅读(116) 评论(0) 推荐(0)
二叉树前序,中序,后序遍历
摘要:1 #define MAX_ARRAY_SIZE 21 2 int array[MAX_ARRAY_SIZE] = {1,2,4,8,0,0,9,0,0,5,10,0,0,0,3,6,0,0,7,0,0}; 3 static int index = 0; 4 5 typedef struct binary_tree_t 6 { 7 int data; 8 str... 阅读全文
posted @ 2018-03-04 22:06 gtxvs 阅读(166) 评论(0) 推荐(0)