![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构与算法
文章平均质量分 76
cl079074282
这个作者很懒,什么都没留下…
展开
-
二分搜索的递归与非递归实现
1.递归方式对有序表进行折半查找 template // SortedList模板类,E元素类型,K关键码类型 int SortedList::BinarySearch(const K x, int low, int high) { int mid = 0; if(low <= high) { mid = (low + high)/2原创 2013-03-01 10:32:41 · 369 阅读 · 0 评论 -
C++顺序栈模板类实现之模板类友元函数实现
最近项目不是很紧张,想把常用的数据结构和算法整理整理写一写,一来加深一下基础,二来以后写一些算法的时候可以多关注算法本身,而对于基本数据 结构可以直接拿过来熟练的使用。希望自己做下去。。。 1.栈的基本接口 const int MAXSIZE = 100; template class Stack{ public: virtual void Push(const T& x) = 0; v原创 2013-03-16 19:47:43 · 881 阅读 · 1 评论 -
双端队列C实现很基础很经典——来自Redis
1、adlist.h /* adlist.h - A generic doubly linked list implementation * * Copyright (c) 2006-2012, Salvatore Sanfilippo * All rights reserved. * * Redistribution and use in source and binary f原创 2013-05-12 10:38:03 · 753 阅读 · 0 评论