Java 中 Hashtable 与 HashMap 的区别
据说这是面试中被问频率非常高的一个问题,下面做简单的记录:
据说这是面试中被问频率非常高的一个问题,下面做简单的记录:
Java 中的 java.util.Iterator 和 java.util.Enumeration 均可用来遍历 Java 中的集合框架(list,map,set 等)。
原题如下:
>Divide two integers without using multiplication, division and mod operator.
If it is overflow, return MAX_INT.
原题如下:
>Given an array and a value, remove all instances of that value in place and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
LeetCode 解题报告 (26)-- 消除有序数组中重复值 (常数空间)
原题如下:
>Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
LeetCode 解题报告 (23)-- 合并 k 个有序数组
原题如下:
>Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.LeetCode 解题报告 (22)-- 生成所有合法的嵌套括号
原题如下:
>Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
搜狗、百度、QQ 输入法的词库爬虫
本文主要讲述了通过 python 实现的用于下载搜狗、百度、QQ 三个输入法的词库的爬虫的实现原理。主要利用了 python 自带的
urllib2、Queue、re、threading模块,并分别通过单线程和多线程实现。最后会给出完整的源码地址。python 中的多线程
本文主要讲述了 python 中多线程的使用、线程锁以及多线程在 python 中是否能够提高效率。
多线程的概念
进程的相信大家都听说过,而线程可以理解为比进程更小一级的概念,一个进程内至少有一个线程,如果有多个线程,那么他们就共享进程的资源,共同完成进程的任务。
使用多线程一般有两个不同的目的:
一是把程序细分成几个功能相对独立的模块,防止其中一个功能模块阻塞导致整个程序假死(GUI 程序是典型)
另一个就是提高运行效率,比如多个核同时跑,或者单核里面,某个线程进行 IO 操作时,另一个线程可以同时执行。具体可以参考这篇文章LeetCode 解题报告 (19)-- 从后往前删除链表第 n 个元素
原题如下:
>Given a linked list, remove the nth node from the end of list and return its head.For example,
Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5.Note:
Given n will always be valid.
Try to do this in one pass.
0%