- 博客(9)
- 资源 (2)
- 收藏
- 关注
原创 字符串整数相加
public string Add(string f_Short, string f_Long) { var result = new List<int>(); bool isFull = false; for (int i = f_Short.Length-1; i >= 0; i--) { var vaule = f_Short[i] + f_...
2020-08-29 17:08:00 914
原创 【算法】将n个有序集合合并成一个新的有序集合
import java.util.*;public class Main { public static void main(String[] args) { List<List<Integer>> lists = new ArrayList<>(); List<Integer> list1 = new ArrayList<>()...
2018-06-05 17:54:58 3510
原创 【算法】将两个非递减整型数组合并成一个新的非递减整型数组
public int[] Merge(int[] a, int[] b) { int pa = 0, pb = 0, pc = 0; int m = a.Length; int n = b.Length; int[] c = new int[m + n]; while (p...
2018-05-21 14:45:59 1330
原创 【算法】C#实现判断括号互相嵌套的正确性问题
//{[{}]([])}或[{()[]}]等为正确格式,而{[( ])}或({[()})等均为不正确的格式。 public bool IsBracketMatch(string str) { Stack<char> stack = new Stack<char>(); for (int i ...
2018-05-11 15:13:38 1483
原创 【算法】C#以最简洁易懂方式实现快速排序算法
//{6,1,2,7,9,3,4,5,10,11,8} QuickSort(arr,0,arr.Length-1) public void QuickSort(int[] arr, int low, int high) { if (low >= high) { return; ...
2018-05-11 09:52:23 469
原创 【算法】解释器模式解决字符串四则运算问题
public class MyInterpreter { //{"(","1","+","2",")","*","3.5"} public MyInterpreter(string[] tokens) { this.Tokens = tokens; this.Finger =
2018-05-10 15:50:11 1178
原创 【算法】判断两个字符串是否互为变形词
public bool IsAnagram(string s1, string s2) { //长度不相等直接返回false if (s1.Length != s2.Length) return false; //字符串中元素出现次数为数组元素 索引为该元素 int[] count = new...
2018-05-02 18:58:19 644
原创 【算法 】C#实现获取一串四则运算表达式第n个括号中内容
/// <summary> /// 获取一串四则运算表达式第n个括号内容 /// </summary> public class BracketString { //1+(5-(10-(6+2))*3) n=3 => 6+2 , n=2 => 10-(6+2)*3 public string G...
2018-04-30 10:41:08 365
原创 【算法】C#字符串四则运算计算器的实现
满足正负浮点数运算public string Compute(string infixExp) { //1 + 3 * 2 - 6 / 2 1 3 2 *+ 6 2/- infixExp = infixExp.Replace(" ", "").Replace("=", ""); //过滤空格和等于号 List&...
2018-04-29 23:15:24 1599
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人