算法
文章平均质量分 80
风雨lei电
这个作者很懒,什么都没留下…
展开
-
heap、红黑树和hash散列
在学习stl容器时,我们接触到了一些底层数据结构,其中,相对比较复杂的结构有heap堆、红黑树和hash散列,接下来针对这三种结构做一些总结:一、heap堆:堆的用处目前见过的有三类:a、堆排序;b、STL容器中,优先队列的底层结构;c、解决海量数据处理中的topK问题。STL里面的堆操作一般用到的只有4个:make_heap();、pop_heap();、push_heap();...原创 2018-05-03 21:21:09 · 722 阅读 · 0 评论 -
几个小问题理解动态规划
求职期间,做很多公司的笔试题,最后的编程题都是往往都能用动态规划的思路解决,接下来,说一说动态规划问题的个人理解:首先,解决动态规划问题掌握两点:1. 动态规划中有三个重要的概念:最优子结构、边界、状态转移公式。2. 动态规划问题的解决思路:从上往底分析,自底向上求解。以例题说明:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\...原创 2018-04-13 16:31:51 · 424 阅读 · 0 评论 -
Queue ADT
问题描述:Given a queue of integers, write an algorithm that, using only the queue ADT, calculatesand prints the sum and the average of the integers in the queue without changing thecontents of the q...原创 2019-09-28 17:17:20 · 461 阅读 · 0 评论 -
stack解决括号问题
问题描述:Write a program to implement “Parse Parentheses” (Algorithm 3-9, discussed in the class),matching braces rather than parentheses. In your implementation, push the line numberinto the stack ...原创 2019-09-28 18:49:29 · 757 阅读 · 0 评论 -
队列ADT的另一种解法
问题描述:同Queue ADT代码:#define _CRT_SECURE_NO_WARNINGS 1#include <assert.h>#include <stdio.h>#include <stdlib.h>#define length 10typedef struct QueueNode{int _dat...原创 2019-09-28 20:35:26 · 108 阅读 · 0 评论