摘要: Binary Trees 树是由结点或顶点和边组成的(可能是非线性的)且不存在着任何环的一种数据结构。没有结点的树称为空(null或empty)树。一棵非空的树包括一个根结点,还(很可能)有多个附加结点,所有结点构成一个多级分层结构。 Binary Tree 的每个结点至多拥有两棵子树(即二叉树中不 阅读全文
posted @ 2022-10-04 04:44 BLUESociety 阅读(1292) 评论(0) 推荐(0)
摘要: 150. Evaluate Reverse Polish Notation Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, and /. E 阅读全文
posted @ 2022-10-04 02:13 BLUESociety 阅读(1441) 评论(0) 推荐(0)
摘要: Stack & Queue 队列是先进先出 栈是先进后出 QUEUE 在 FIFO 数据结构中,将首先处理添加到队列中的第一个元素。 插入(insert)操作也称作入队(enqueue),新元素始终被添加在队列的末尾。 删除(delete)操作也被称为出队(dequeue)。 你只能移除第一个元素。 阅读全文
posted @ 2022-10-01 05:03 BLUESociety 阅读(1447) 评论(0) 推荐(0)
摘要: 459. Repeated Substring Pattern Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the subs 阅读全文
posted @ 2022-09-30 03:37 BLUESociety 阅读(1574) 评论(0) 推荐(0)
摘要: 28. Find the Index of the First Occurrence in a String Given two strings needle and haystack, return the index of the first occurrence of needle in ha 阅读全文
posted @ 2022-09-30 03:02 BLUESociety 阅读(593) 评论(0) 推荐(0)
摘要: 344. Reverse String Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the 阅读全文
posted @ 2022-09-29 00:18 BLUESociety 阅读(1789) 评论(0) 推荐(0)
摘要: 454. 4Sum II Given four integer arrays nums1, nums2, nums3, and nums4 all of length n, return the number of tuples (i, j, k, l) such that: 0 <= i, j, 阅读全文
posted @ 2022-09-28 03:10 BLUESociety 阅读(1845) 评论(0) 推荐(0)
摘要: Hash table 一般哈希表都是用来快速判断一个元素是否出现集合里。 例如要查询一个名字是否在这所学校里。 要枚举的话时间复杂度是O(n),但如果使用哈希表的话, 只需要O(1)就可以做到。 Hash Function 通过hashCode把名字转化为数值,一般hashcode是通过特定编码方式 阅读全文
posted @ 2022-09-27 05:11 BLUESociety 阅读(1993) 评论(0) 推荐(0)
摘要: 24. Swap Nodes in Pairs Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the value 阅读全文
posted @ 2022-09-24 01:53 BLUESociety 阅读(1997) 评论(0) 推荐(0)
摘要: ###链表理论基础 链表是一种通过指针串联在一起的线性结构,每一个节点由两部分组成,一个是数据域(Node) 一个是指针域(Next),最后一个节点的指针域指向null。 链接的入口节点称为链表的头结点也就是head。 单链表中的指针域只能指向节点的下一个节点。 双链表:每一个节点有两个指针域,一个 阅读全文
posted @ 2022-09-23 02:57 BLUESociety 阅读(2366) 评论(0) 推荐(0)