CC150 chapter 1 Arrays and strings.

本文总结了《Cracking the Coding Interview》第一章的关键内容,包括哈希表的实现原理及在Java中的应用,动态调整大小的数组ArrayList,以及用于频繁字符串操作的StringBuffer。此外还探讨了几道典型算法题的解决方案,如判断字符串中字符是否唯一,以及字符串是否为另一个字符串的排列。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CC150 chapter 1 总结

1

HashTable:  实质是Array. 如何实现HashTable 在Java中

Here is the way that implments the hash table. A hashtable is a array of listnode. and the time complexity for all the basic operation including search, add and remove  is O(1).

Here is how to implement the hashtable


http://math.hws.edu/javanotes/c10/ex3-ans.html. 

when the number of the hashtable elements exceeds the 0.75* the length of the hashtable. then we need to rehash it.


ArrayList  是一个长度可变的数组

http://www.tutorialspoint.com/java/java_arraylist_class.htm


StringBuffer 实现了一个String数组,是一个String , 通常当对String多次操作时,选用StringBuffer 可以节省程序空间


1 题目 implement a determine a if all the chars in a string are unique, use the array for 32 bits. boolean judge = new judge[32];


2 decide if a string is a permutation of the other.  use the int[]数组统计。注意首先进行长度的判断


3 rotate a image.


4judge if the string is a rotated version of the other s1s1 ,s2 judge is substring. 

method how to judge if this is substring.?


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值