linear probing java_java和数据结构的面试考点

目标:不要有主要的逻辑错误、2遍以内bug free、注意代码风格 不要让面试官觉得不懂规矩

Java vs C++

Abstract class vs interface

pass by reference vs pass by value

Final/Finally/Finalize

static

函数参数或者函数中的局部变量和成员变量同名的情况下,成员变量被屏蔽,此时要访问成员变量则需要用“this.成员变量名”的方式来引用成员变量。当然,在没有同名的情况下,可以直接用成员变量的名字,而不用this,用了也不为错。

凡是被private修饰的成员变量,都称为私有变量。它只允许在本类的内部访问,任何外部类都不能访问它。private变量在public方法中被屏蔽 不能用,需要用this关键字自定义。

列表对比:

成员变量、局部变量、静态变量的区别

成员变量

局部变量

静态变量static

定义位置

在类中,方法外

方法中,或者方法的形式参数

在类中,方法外

初始化值

有默认初始化值

无,先定义,赋值后才能使用

有默认初始化值

调用方式

对象调用

---

对象调用,类名调用

存储位置

堆中

栈中

方法区

生命周期

与对象共存亡

与方法共存亡

与类共存亡

别名

实例变量

类变量

volatile

Primitive types

overriding vs overloading

Public static void main(String[] args)

Checked / unchecked exception

Garbage collection

JVM

Java object class method

Java Serialization

Java heap/stack

Java thread

Java 8 vs. java7

ArrayList vs LinkedList

Vector vs ArrayList:Multi-threaded access but slow VS Dynamic array

Use Array implement ArrayList:public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)

二者的区别:

1 ArrayList是一个类,所以它持有了所有类的属性.例如,你可以创建对象,可以调用方法,但array并不提供任何方法. 它仅仅暴露了一个常量的长度来表示当前数组的长度.

2 ArrayList 是动态的,它可以在需要的时候扩大自己的内存,这是一个 array 不可能做到的.ArrayList 也允许你删除元素, 这在array上也是不可能的.

3 array可以使多维度的.例如,你可以设置一个二维数组或者三维数组.可以使你创在一个特殊的数据结构来代表矩阵或者2D形式(terrains),另一方面,ArrayList并不支持允许你指定维度

TreeSet VS HashSet

HashMap vs HashSet

2.3. Map

Collision resolution: Separate chainning/Linear Probing

HashMap原理

HashMap vs TreeMap

HashMap vs Hashtable

HashMap Vs. ConcurrentHashMap Vs. SynchronizedMap

LinkededHashMap

2.4. Arrays

Array的基本操作

2.5. Stack

Recursion

DFS

2.6. Queue

FIFO / PriorityQueue

BFS

Deque:Arraydeque/Linkedlist

Blockingqueue

2.7. Sort

bubble sort/selection sort/insert sort (n^2)

mergesort/quicksort/heapsort (nlogn)

e8fcb9f2bafb6526e189f0ed9f081709.png从大的一分为二变成小的一分为二。最坏时每个数互相比较一遍,为n^2

2.8. heap

Priority Queue:

PriorityQueue这种数据结构支持按照优先级取出里面的元素。这是和其它常用数据结构,比如 ArrayList, Queue, Stack等最大的区别。因为要支持优先级,而heap具有类似的结构,所以,PriorityQueue一般都是基于HEAP实现的。(也可以用其它数据结构实现,但是各种复杂度会有不同。)

add添加元素逐个sift up,pop删除元素头尾交换后sift down,删除操作:先在数组中交换(n)再up or down(lgn)(底层的数据结构都是用数组来维护的)

hashheap:删除操作时,先在hash中1查找,之后直接指向heap,再up or down,故为lgn

Comparator vs Comparable

Binary Tree

k叉树

B树/B+ 树

Trie Tree

---

Coding

In-order/Pre-order/Post-order traversal of binary tree

Binary Search

Sort

Greedy

Breadth-first search

Depth-first search

Divide and Conquer

Dynamic Programming

Graph

-- Python --

What is Python & PEP 8?

What is pickling and unpickling?

How Python is interpreted?

How memory is managed in Python?

What are Python decorators?

What is the difference between list and tuple?

How are arguments passed by value or by reference?

What are the built-in type does python provides?

What is namespace in Python?

What is lambda in Python?

In Python what are iterators?

What are generators in Python?

In Python what is slicing?

What is module and package in Python?

--------------------------------

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值