- 博客(19)
- 收藏
- 关注
原创 数据结构——线性表的链式表示
https://blog.youkuaiyun.com/qq_31736627/article/details/52848001(这是关于结构体的一篇较好的博客)初学者可能会关注如下的内容:下面是正题。1、线性表是具有相同数据类型的n个元素的优先序列。2、线性表的链式存储称为单链表。为了建立线性表之间的线性关系,对每个链表结点,除了存档数据之外,还有一个指向其后继的指针。单链表的结点类型描...
2018-09-09 20:44:00
380
原创 操作系统-信号量(生产者消费者问题)
1、问题描述:一组生产者进程和一组消费者进程共享一个初始为空大小为n的缓冲区,只有缓冲区没满时,生产者才能给缓冲区投放信息,否则必须等待;只有缓冲区不空时,消费者才能继续取出消息,否则也必须等待。由于缓冲区是临界资源,他只允许一个进程投放资源或者一个进程取出资源。2、分析:首先,缓冲区是临界资源,那么不论是生产者还是消费者访问临界资源的时候都必须是互斥的访问。所以,对于访问临界资源必须有个互斥信号...
2018-07-08 14:13:50
5726
2
原创 算法分析与设计课程——LeetCode刷题之Search for a Range
题目:Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).
2018-01-11 22:10:17
237
原创 算法分析与设计课程——LeetCode刷题之 Rotate Image
题目:You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note:You have to rotate the image in-place, which means you have to modify the inpu
2018-01-11 22:07:15
202
原创 算法分析与设计课程——LeetCode刷题之 Pow(x, n)
题目:Implement pow(x, n).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000, 3Output: 9.26100答案:class Solution {public: double pow(double x, int
2018-01-07 20:00:14
185
原创 算法分析与设计课程——LeetCode刷题之Decode Ways
题目:A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the t
2018-01-07 19:55:29
241
原创 算法分析与设计课程——LeetCode刷题之 Word Search
题目:Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or v
2018-01-07 14:23:38
179
原创 算法分析与设计课程——LeetCode刷题之 Spiral Matrix
题目:Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9
2018-01-07 14:19:47
202
原创 算法分析与设计课程——LeetCode刷题之 Climbing Stairs
题目:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will
2018-01-07 14:16:41
243
原创 算法分析与设计课程——LeetCode刷题之 Merge k Sorted Lists
题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.答案:public class Solution { public ListNode mergeKLists(List lists) {
2018-01-07 14:12:41
255
原创 算法分析与设计课程——LeetCode刷题之Remove Duplicates from Sorted Array
题目:Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this by m
2018-01-07 14:08:22
174
原创 算法分析与设计课程——LeetCode刷题之Valid Parentheses
题目:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are
2018-01-07 14:04:22
209
原创 算法分析与设计课程——LeetCode刷题之Merge Two Sorted Lists
题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1->1
2018-01-03 00:57:30
241
原创 算法分析与设计课程——LeetCode刷题之4Sum
题目:Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: The s
2018-01-03 00:53:51
209
原创 算法分析与设计课程——LeetCode刷题之3Sum
题目:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not co
2018-01-03 00:40:03
194
原创 编译原理第一个项目——个人所得税PersonalTax
1、实验目的本实验面向 Java 语言的初学者,假设学生已掌握结构化程序设计方法,对面向对象程序设计方法有初步了解。学生最好至少已掌握一门 Java 之外的面向对象程序设计语言,例如 C++或 Smalltalk-80。学生通过本实验可掌握 Java 程序的开发过程,以及面向对象技术中封装、信息隐藏、数据抽象、异常处理等机制在实际应用中的有机运用,并养成遵循良好程序设计编码规范的风格。学...
2017-09-15 23:03:48
1176
原创 算法分析与设计——leetcode刷题之Add Two Numbers(Medium)
一、题目 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and...
2017-09-11 12:14:35
232
原创 算法分析与设计——LeetCode刷题之TwoSum(easy)
这是上了第一节选法分析与设计之后再老师指定的网站LeetCode上打的题目,这门课的重点不是如何去编写代码而是如何用代码实现算法。
2017-09-07 00:44:35
278
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅