- 博客(16)
- 资源 (1)
- 收藏
- 关注
原创 HashTable和HashMap的原理
昨天看了算法导论对散列表的介绍,今天看了一下Hashtable, HashMap这两个类的源代码,并参考了网上的一些观点,对它们的实现有了大概的理解。原来hashtable里的key-value还是用数组存储的,数组元素是Entry类型,同一数组索引下储存的实质是一个Entry链表,Entry中的next值指向下一个Entry.当把key-value放进hashtable时,会根据key的hash
2012-12-12 14:23:15 514
原创 统计程序的计算时间。
public class Timing { TimeSpan duration; public Timing() { duration = new TimeSpan(0); } public void StartTime() {
2012-12-11 11:19:02 480
原创 数据结构-二分查找算法
private static bool BinSearch(int val) { int mid=0; int lowerBound = 0; int upperBound=array1.Length-1; while (low
2012-12-11 11:18:34 644
原创 数据结构-插入排序算法
for (int i = 1; i { int curvalue = array[i]; int temp = i; while (temp > 0 && array[temp - 1] > curvalue) {
2012-12-11 11:18:04 423
原创 数据结构-选择排序算法
int min, temp, k = 0; for (int i = 0; i { min = array[i]; for (int j = i + 1; j { if (min > array[j]
2012-12-11 11:17:37 352
原创 数据结构-冒泡排序算法
int temp; int[] arr = new int[] { 1, 3, 8, 4, 5, 7, 10, 12 }; for (int j = 0; j { for (int i = arr.Length - 1; i > j; i--) { int a = arr[j];
2012-12-11 11:17:03 474
原创 C#实现的洗牌算法
<br />using System; <br />using System.Diagnostics; <br /> <br />namespace Lucifer.CSharp.Sample <br />{ <br /> class Program <br /> { <br /> static void Main(string[] args) <br /> { <br /> //初始化牌局 <br /> int[] ar
2011-04-29 13:20:00 2065
原创 C#控件的闪烁问题解决方法
protected override void WndProc(ref Message m) { if (m.Msg == 0x0014) // 禁掉清除背景消息 return; base.WndProc(ref m); }
2011-04-28 14:03:00 1183
原创 ListView 列添加动态加载图片
1.把动态的GIF图片全部提取出不同的帧图片2.再把这些图片添加到ImageList里3.界面添加个定时器 时间设置为1004.循环加载图片实现图片的切换//SetStyle(ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);listView1.Items[0].ImageIndex = num; num++;
2011-04-26 13:59:00 1766
原创 Jquery操作
jquery radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中,及其相关<br />获取一组radio被选中项的值<br />var item = $('input[@name=items][@checked]').val();<br />获取select被选中项的文本<br />var item = $("select[@name=items] option[@selected]").text();<br />select下拉框的第二个元素为当
2011-04-21 09:08:00 346
原创 Orcale 多用户导入,导出的SQL
<br />导出:<br />exp system/passwd file=myexp.dmp log=myexp.log owner=user1,user2,user3<br /><br />导入:<br />imp system/passwd file=myexp.dmp log=myimp.log fromuser=user1 touser=user1<br />imp system/passwd file=myexp.dmp log=myimp.log fromuser=user2 touser=u
2011-04-21 09:06:00 712
原创 C# 操作Access的公共类
<br /> using System;<br />using System.Collections.Generic;<br />using System.Linq;<br />using System.Text;<br />using System.Data.OleDb;<br />using System.Windows.Forms;<br />using System.Data;<br /><br />namespace Test<br />{<br /> /
2011-04-20 17:01:00 636
原创 .NET网络通信基础(1)
1.了解Socket Socket自提出以来一直就是网络应用程序最重要且应用最为广泛的技术 通过Socket概念进行网络联机,可以避免处理切割数据封包、分段传输与数据重组等繁复的细节。 2. 命名空间System.Net.Sockets命名空间主要包括Sockets网络通信应用程序的相关类: ◦Socket类 ◦TCPClient类 ◦TCPListener类 ◦UDPClient类 ◦NetworkStream类 ◦3. Socket类的方法成员 Bind方法 }Accept方法 }Connect
2011-04-17 11:49:00 605
原创 揭开LINQ面纱(1)
1.LINQ操作数组 int[] arr = { 213, 454, 6477, 841, 1, 3, 46, 75, 692, 465, 134, 4156, 123, 456, 789 }; IEnumerable ie = arr.Select(p => p).Where(p => p > 50); IEnumerator result = ie.GetEnumerator(); while (result.MoveNext())
2011-04-17 10:43:00 379
原创 Winform模拟登陆网站
对某个网站进行登陆可用HttpWebRequest进行模拟登陆。主要代码如下HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);//根据地址创建个request对象string data = "accountName=" +name+"&password=" + password";//参数srequest.CookieContainer = new CookieContainer();//创建Cookierequest.Metho
2011-04-17 10:11:00 1627
原创 Grid++Report 报表动态使用
<br />1.使用报表设计器添加你要的记录集和标题行/内容行等内容<br />2.加载时 GridppReport _subReport = new GridppReport();创建个报表对象<br />3.<br />创建个构造类<br /> private struct MatchFieldPairType<br /> {<br /> public IGRField grField;<br /> public int MatchColumn
2010-09-01 17:12:00 11794 2
jquery1.5.js
2011-04-20
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人