
算法
小牛呼噜噜
书写思维的火花
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
算法学习之旅--
开始学习算法之旅问题:最优方法:在线处理法#include<stdio.h>int MaxSubseqSum( int A[], int N){int ThisSum,MaxSum;int i;ThisSum = MaxSum = 0;for(i=0;i<N;i++){ThisSum += A[i];//向右累加if (ThisSum &g...原创 2018-09-18 19:41:25 · 317 阅读 · 0 评论 -
算法学习之旅-线性表及其实现
目录1.1、定义1.2、注意操作的实现(1)初始化(建立空的顺序表)(2)查找 (X)(3)插入 (在第i(1<=i<=n+1)个位置上插入一个值为X的新元素)(4)删除(在第i(1<=i<=n+1)个位置上删除一个值为X的新元素)2、链式存储(链表)2.1、定义:2.2、实现操作(1)求表长(2)查找(3)插入(在第i...原创 2018-09-20 09:19:02 · 179 阅读 · 0 评论 -
堆栈
目录 1、堆栈的抽象数据类型描述2、堆栈的定义(顺序存储的实现)3、常用操作的实现(顺序存储的实现)3.1、入栈3.2、出栈4、堆栈(链式存储的实现)5、堆栈的应用场景6、表达式求值1、堆栈的抽象数据类型描述2、堆栈的定义(顺序存储的实现)#define MaxSize <储存数据元素的最大个数>typedef struct ...原创 2018-10-10 20:37:27 · 384 阅读 · 0 评论 -
简单的算法(1)--从尾到头打印链表
目录1、java实现1.1、递归1.1.1、测试(完整源码)1.2、利用栈来实现1.2.1、测试2、C语言2.1、先将链表反转,再从头输出(改变链表的结构)2.2、利用栈的“先进后出”特性 1、java实现链表的定义: public class ListNode { int val; ListNode next = ...原创 2018-11-08 23:52:17 · 319 阅读 · 0 评论 -
简单的算法(2)--二维数组中的查找
替换空格 题目为牛客网上的题目详述在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。 代码:public class Solution { 2 public boolean Find(int target, int [][] ...原创 2019-02-23 12:30:34 · 176 阅读 · 0 评论 -
Leetcode刷题小记(1)--T1
1.Two SumGiven an array of integers, returnindicesof the two numbers such that they add up to a specific target.You may assume that each input would haveexactlyone solution, and you may not u...原创 2019-05-30 17:36:52 · 239 阅读 · 0 评论 -
Leetcode刷题小记(2)--T2
2.Add Two NumbersYou are given twonon-emptylinked lists representing two non-negative integers. The digits are stored inreverse orderand each of their nodes contain a single digit. Add the two ...原创 2019-05-30 17:47:06 · 241 阅读 · 0 评论 -
Leetcode刷题小记(3)--T3
3.Longest Substring Without Repeating CharactersGiven a string, find the length of thelongest substringwithout repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The...原创 2019-05-31 16:25:08 · 206 阅读 · 0 评论