[TOC]
线性表肯定有题目 单链表尤其高 栈和队列也高 双向链表好像不考 约瑟夫没考 多项式没考
排序必看
不考一个数组实现两个栈
Linear List
Linked List
几个基本方法delete insert
可能带有表头有,表头不存放数据
package DataStructures;
class ListNode{
ListNode( object theElement){
this( theElement, null);
}
ListNode( object theElement, ListNode n){
element = theElement;
next = n;
}
object element;
ListNode next;
}
public class LinkedListItr{
LinkedListItr( ListNode theNode){
current = theNode;
}
public boolean isPastEnd( ){
return current = = null;
}
public object retrieve( ){
return isPastEnd( ) ? Null : current.element;
}
public void advance( ){
if( ! isPastEnd( ) ){
current = current.next;
}
}
ListNode current;
}
public class LinkedList{
public LinkedList( )
{ header = new ListNode( null ) ; }
public boolean isEmpty( )
{ return header.next = = null ; }
public void makeEmpty( )
{ header.next = null; }
public LinkedListItr zeroth( )
{ return new LinkedListItr( header ) ; }
public LinkedListItr first( )
{ return new LinkedListItr( header.next ) ; }
public LinkedListItr find( object x )
public void remove( object x )
public LinkedListItr findPrevious( object x )
public void insert( object x, LinkedListItr p )
private ListNode header;
}
Stack
LIFO
Queue
杨辉三角