









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










info
info
info
list
info
info
info
list
info
list
List
ArrayList LinkedList
UnsortedArrayList SortedArrayList UnsortedLinkedList SortedLinkedList CircularSortedLinkedList
info
info
info
info
prevLoc list ์ผ๋ฐ์ ์ธ ๊ฒฝ์ฐ prevLoc.next = loc.next;
info
10
info
info
info
40
loc list
loc
prevLoc
list.next = list.next.next; ๋๋ list.next = loc.next;
info
info
info
info
prevLoc list
prevLoc.next = loc.next; list = prevLoc;
info
10
list
loc
list = null;
prevLoc
loc
public boolean delete(Object item) throws ListUnderflowException{ if(isEmpty()) throw new ListUnderflowException(โโฆโ); Comparable x = (Comparable)item; ListNode loc = list.next; ListNode prevLoc = null; for(int i=0;i<size;i++){ int compResult = x.compareTo(loc.info); if(compResult==0){ // ์ญ์ ํ ๋ ธ๋๊ฐ ์กด์ฌํ๋ ๊ฒฝ์ฐ if(prevLoc==null){ // ์ฒซ ๋ ธ๋๋ฅผ ์ญ์ ํ๋ ๊ฒฝ์ฐ if(loc == loc.next) list = null; // ์ฒซ ๋ ธ๋๊ฐ ์ ์ผ ๋ ธ๋์ธ ๊ฒฝ์ฐ else list.next = loc.next; } else{ prevLoc.next = loc.next; if(loc==list) list = prevLoc; // ๋ง์ง๋ง ๋ ธ๋๋ฅผ ์ญ์ ํ๋ ๊ฒฝ์ฐ } size--; return true; } else if(compResult<0) return false; else{ prevLoc = loc; loc = loc.next; } } // for return false; } // CircularSortedList::delete
if(loc == loc.next) ๋์ ์ if(size==1)๋ฅผ ์ฌ์ฉํ ์ ์์
์ฒซ ๋ ธ๋์ ๋ง์ง๋ง ๋ ธ๋๋ฅผ ๋ชจ๋ ์ ๊ทผํ๊ธฐ๊ฐ ์ฉ์ดํ๋ค๋ ์ํ ์ฐ๊ฒฐ ๊ตฌ์กฐ์ ํน์ฑ์ ์ด์ฉํ์ฌ
๋ณด๋ค ํจ์จ์ ์ผ๋ก delete ๋ฉ์๋๋ฅผ ๊ตฌํํ ์ ์๋ค. ์ฆ, ์ฒซ ๋ ธ๋์ ๋ง์ง๋ง ๋ ธ๋์ ๋น๊ตํ์ฌ
์ฒซ ๋ ธ๋๋ณด๋ค ์์ ๊ฒฝ์ฐ์ ์ฒซ ๋ ธ๋์ ํฐ ๊ฒฝ์ฐ์ ๋ํด์๋ ๋ฆฌ์คํธ ์ ์ฒด๋ฅผ ๊ฒ์ํ์ฌ ์ญ์ ํ ๋ ธ
๋๊ฐ ์๋์ง ์ฐพ๋ ๊ณผ์ ์ ์๋ตํ ์ ์๋ค.
public boolean delete(Object item) throws ListUnderflowException{ if(isEmpty()) throw new ListUnderflowException(โโฆโ); Comparable x = (Comparable)item; if(x.compareTo(list.next.info)<0||x.compareTo(list.info)>0){ return false; } // ๋๋จธ์ง ๋ถ๋ถ์ ๋์ผ
} // CircularSortedList::delete
์ด์ฉํ delete ๋ฉ์๋
public void insert(Object item){ Comparable x = (Comparable)item; ListNode newNode = new ListNode(); newNode.info = item; newNode.next = null; ListNode loc = (list==null)? null: list.next; ListNode prevLoc = null; for(int i=0;i<size;i++){ // ์ฝ์ ํ ์์น ์ฐพ๊ธฐ if(x.compareTo(loc.info)<0) break; else{ prevLoc = loc; loc = loc.next; } } // for if(prevLoc==null){ // ๋ฆฌ์คํธ ๋งจ ์์ ์ฝ์ ๋๋ ๊ฒฝ์ฐ // ๋ฆฌ์คํธ๊ฐ ๋น์ด์๋ ๊ฒฝ์ฐ if(list==null){ list = newNode; newNode.next = newNode; } else{ newNode.next = loc; list.next = newNode; } } else{ newNode.next = loc; prevLoc.next = newNode; // ๋ฆฌ์คํธ์ ๋งจ ๋ง์ง๋ง์ ์ฝ์ ๋๋ ๊ฒฝ์ฐ if(prevLoc == list) list = newNode; } size++; } // CircularSortedList::insert
์ ์ฌ๋ผ์ด๋์ ์๋ ์ฝ์ ์ฐ์ฐ์ ๊ธฐ์กด ์ ๋ ฌ ์ฐ๊ฒฐ ๋ฆฌ์คํธ์ ๋์ผํ ๋ฐฉ๋ฒ์ผ๋ก ๊ตฌํํ ๊ฒ์ด๋ค.
๋จผ์ ์ฝ์ ํ ์์น๋ฅผ ์ฐพ์ ๋ค์, ์ฝ์ ํ ์์น์ ๋ฐ๋ผ ํ์ํ ๊ฐ ์ข ์ฐ๊ฒฐ์ ๋ณ๊ฒฝํ๋ ๋ฐฉ์์ด
๋ค. ๋ค์ ์ฌ๋ผ์ด๋์ ์๋ ์ฝ์ ์ฐ์ฐ์ ์ํ ์ฐ๊ฒฐ ๋ฆฌ์คํธ์ ํน์ฑ์ ํ์ฉํ๊ณ ์๋ค. ์ฆ, ์
์์๋ฅผ ์ถ๊ฐํ ๋ ๊ทธ ์์๋ฅผ ๋ฆฌ์คํธ์ ์ฒซ ์์์ ๋ง์ง๋ง ์์์ ๋น๊ตํ์ฌ ์ฒซ ์์๋ณด๋ค ์๊ฑฐ
๋ ๋ง์ง๋ง ์์๋ณด๋ค ํด ๊ฒฝ์ฐ์๋ ์ด๊ฒ์ ๋จผ์ ์ฒ๋ฆฌํ์ฌ ์ค๋ค. ๋ ๊ฒฝ์ฐ๋ ์ ๋ ฌ๋ ์ํ ์ฐ๊ฒฐ
๊ตฌ์กฐ์ ํน์ฑ ์ ๊ฐ์ ์์น์ ์ฝ์ ๋๋ ํํ๊ฐ ๋๋ค.
public void insert(Object item){ Comparable x = (Comparable)item; ListNode newNode = new ListNode(); newNode.info = item; newNode.next = null; size++; if(list==null){ list = newNode; newNode.next = newNode; return; } // ๋ฆฌ์คํธ๊ฐ ๋น์ด ์๋ ๊ฒฝ์ฐ if(x.compareTo(list.next.info)<0||x.compareTo(list.info)>0){ newNode.next = list.next; list.next = newNode; if(x.compareTo(list.info)>0) list = newNode; // ๋งจ ๋์ ์ฝ์ ๋๋ ๊ฒฝ์ฐ return; } // ์ฝ์ ํ๊ณ ์ ํ๋ ๋ ธ๋๊ฐ ์ฒซ ๋ ธ๋๋ณด๋ค ์๊ฑฐ๋ ๋ง์ง๋ง ๋ ธ๋๋ณด๋ค ํฐ ๊ฒฝ์ฐ // ์ฒซ ๋ ธ๋์ ๋น๊ตํ ํ์ ์์ ListNode loc = list.next.next; ListNode prevLoc = list.next; for(int i=0;i<size;i++){ if(x.compareTo(loc.info)<0){ newNode.next = loc; prevLoc.next = newNode; return; } else{ prevLoc = loc; loc = loc.next; } } // for } // CircularSortedList::insert
์ด์ฉํ insert ๋ฉ์๋
CircularSortedLinkedList์ ์ฅ๋จ์
์ํ ์ ๋ ฌ ์ฐ๊ฒฐ ๋ฆฌ์คํธ์ ์ฅ์ ์ ๊ธฐ์กด ์ ๋ ฌ ์ฐ๊ฒฐ ๋ฆฌ์คํธ์ ๋น๊ตํ์ฌ ๋ณด์. ์ฐ์ฐ์ ์ฑ๋ฅ ์ธก
๋ฉด์์ ๋ณด๋ฉด ํฅ์๋ ๊ฒ์ด ๊ฑฐ์ ์๋ค. ๊ทธ๋ฌ๋ ์ํ ์ ๋ ฌ ์ฐ๊ฒฐ ๋ฆฌ์คํธ๋ ์ฒซ ๋ ธ๋๋ฟ๋ง ์๋๋ผ
๋ง์ง๋ง ๋ ธ๋์ ๋ํ ์ ๊ทผ์ด ์ฉ์ดํ๋ฏ๋ก ๋ค์๊ณผ ๊ฐ์ ์๋น์ค๋ ๊ธฐ์กด ์ ๋ ฌ ์ฐ๊ฒฐ ๋ฆฌ์คํธ๋ณด๋ค
์ฐ์ํ๋ค.
์ฒซ์งธ, ๊ฐ์ฅ ํฐ ๊ฐ์ ์ถ์ถ
๋์งธ, ๋ฆฌ์คํธ์ ์ ์ฅ๋ ๊ฐ๋ค ์ฌ์ด์ ์๋ ๊ฐ์ธ์ง ์ ํ์๊ฐ ์๋ ๊ฒฝ์ฐ
์ ์งธ, ์ ๋ ฌ๋ ๋ฐ์ดํฐ๋ฅผ ์ฐ์ํด์ ์ฝ์ ํ๋ ๊ฒฝ์ฐ
๋ง์ง๋ง ์๋น์ค์ ๊ฒฝ์ฐ์๋ ์ฝ์ ์ฐ์ฐ์ด ์ํ ์ฐ๊ฒฐ ๋ฆฌ์คํธ์ ํน์ฑ์ ํ์ฉํ๊ณ ์์ด์ผ ํ๋ค.
์ด๋ฐ ์ธก๋ฉด์์ ๋ณด์์ ๋ ์ผ๋ฐ ์ ๋ ฌ ์ฐ๊ฒฐ ๋ฆฌ์คํธ์์ ๋ง์ง๋ง ๋ ธ๋๋ฅผ ๊ฐ๋ฆฌํค๋ ํฌ์ธํฐ๋ฅผ ํ
๋ ๋ ์ ์งํ๋ ๋ฐฉ๋ฒ์ ์๊ฐํด ๋ณผ ์ ์๋ค. ์คํ๋ ค ์ด ๋ฐฉ๋ฒ์ด ์ํ ์ฐ๊ฒฐ ๋ฆฌ์คํธ์ ๋นํด ์ฐ
์ํ ์ ์๋ค.
public abstract class DoubleLinkedList implements List{ protected class ListNode{ public Object info; public ListNode back; public ListNode next; } protected class ListIterator{ โฆ } protected ListNode list = null; protected int size = 0; public DoubleLinkedList() {} public abstract boolean search(Object item) throws ListUnderflowException; public abstract void insert(Object item); public abstract boolean delete(Object item) throws ListUnderflowException; public abstract Object retrieve(Object item) throws ListUnderflowException; public boolean isFull(){ return false; } public boolean isEmpty(){ return (list == null); } public void clear{ list = null; } public int size(){ return size; } public Iterator iterator() { return new ListIterator(list); } } // DoubleLinkedList class
DoubleLinkedList์์ ๋ ธ๋๋ฅผ ๋ํ๋ด๋ ํด๋์ค์ ์ด๋ฆ์ ListNode์ด๊ณ , ๋ฐ๋ณต์ ํด๋์ค์ ์ด
๋ฆ์ ListIterator์ด๋ค. ์ฆ, LinkedList๊ฐ ์ฌ์ฉํ๋ ์ด๋ฆ๊ณผ ๋์ผํ ์ด๋ฆ์ ์ฌ์ฉํ๋ค. ํ์ง๋ง ๋ด
๋ถ ํด๋์ค์ ์ด๋ฆ์ด๋ฏ๋ก ์ด๋ ๊ฒ ๊ฐ์ ์ด๋ฆ์ ์ฌ์ฉํ์ฌ๋ ๋ฌธ์ ๊ฐ ๋์ง ์๋๋ค.
protected class ListIterator{ public ListNode cursor; public int traverseCount = 0; public ListIterator(ListNode node){ cursor = node; } // ListIterator(ListNode) public boolean hasBack(){ return (traverseCount>0); } public boolean hasNext(){ return (traverseCount<size); } public Object back(){ Object tmp = cursor.info; cursor = cursor.back; traverseCount--; return tmp; } // back public Object next(){ Object tmp = cursor.info; cursor = cursor.next; traverseCount++; return tmp; } // next public void remove(){ throw new UnsupportedOperationException(); } // remove }
์ด์ค ์ฐ๊ฒฐ ๋ฆฌ์คํธ์์ ๋ฐ๋ณต์ ํด๋์ค์๋ ๊ธฐ์กด ์ฐ๊ฒฐ ๋ฆฌ์คํธ์๋ ์๋ back๊ณผ hasBack ๋ฉ์
๋๊ฐ ์ถ๊ฐ๋ก ๊ตฌํ๋์ด์ผ ํ๋ค. ์ฆ, ์ฃผ์ด์ง ๋ ธ๋๋ก๋ถํฐ ๊ทธ๊ฒ์ ์ ํ ๋ ธ๋๋ฅผ ๋ฐฉ๋ฌธํ ์ ์๋
๋ฉ์๋๋ฅผ ์ ๊ณตํด์ฃผ์ด์ผ ํ๋ค.
SortedDoubleLinkedList์ Insert
info
list info
info
info
loc
newNode.back = prevLoc; newNode.next = loc; prevLoc.next = newNode; loc.back = newNode;
info
prevLoc
newNode.next = loc; loc.back = newNode; list = newNode;
loc
info
newNode.back = prevLoc; prevLoc.next = newNode;
prevLoc
์ด์ค ์ ๋ ฌ ์ฐ๊ฒฐ ๋ฆฌ์คํธ์์ ์ฝ์ ์ฐ์ฐ์ ์ผ๋ฐ ์ ๋ ฌ ์ฐ๊ฒฐ ๋ฆฌ์คํธ์ ์ฝ์ ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก ํฌ๊ฒ
๋ค ๊ฐ์ง ๊ฒฝ์ฐ๋ฅผ ๊ณ ๋ คํด์ผ ํ๋ค. ์ ์ฌ๋ผ์ด๋์์ ์ด ์ค ๋ฆฌ์คํธ๊ฐ ๋น ๊ฒฝ์ฐ์ ์ฝ์ ํ๋ ๊ฒฝ์ฐ
๋ฅผ ์ ์ธํ ๋๋จธ์ง ์ธ ๊ฐ์ง ๊ฒฝ์ฐ์ ๋ํด ์ฐ๊ฒฐ์ ๋ณ๊ฒฝํ๋ ๋ฐฉ๋ฒ์ ์ค๋ช ํ๊ณ ์๋ค.
public void insert(Object item){ Comparable x = (Comparable)item; ListNode newNode = new ListNode(); newNode.info = item; newNode.back = null; newNode.next = null; ListNode loc = list; ListNode prevLoc = null; for(int i=0;i<size;i++){ // ์ฝ์ ํ ์์น๋ฅผ ์ฐพ๋๋ค. if(x.compareTo(loc.info)<0) break; else{ prevLoc = loc; loc = loc.next; } } // for if(prevLoc==null){ // ๋ฆฌ์คํธ ๋งจ ์์ ์ฝ์ ๋๋ ๊ฒฝ์ฐ list = newNode; newNode.next = loc; if(list!=null) loc.back = newNode; // ๋น ๋ฆฌ์คํธ๊ฐ ์๋ ๊ฒฝ์ฐ } else{ newNode.back = prevLoc; newNode.next = loc; prevLoc.next = newNode; if(loc!=null) loc.back = newNode; // ๋งจ ๋ง์ง๋ง์ ์ฝ์ ๋๋ ๊ฒฝ์ฐ๊ฐ ์๋๋ฉด } size++; } // SortedDoubleLinkedList::insert
if(prevLoc==null)์ด ์ฐธ์ด๋ฉด ์ ์์๋ฅผ ๋ฆฌ์คํธ์ ์ฒซ ๋ ธ๋๋ก ์ฝ์ ํ๋ ๊ฒฝ์ฐ์ด๋ค. ์ด ๊ฒฝ์ฐ๋ ๋ค
์ ๋ฆฌ์คํธ๊ฐ ๋น ๊ฒฝ์ฐ์ ๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ๋ก ๋๋์ด์ง๋ค. ๋ฐ๋๋ก ์กฐ๊ฑด์ด ๊ฑฐ์ง์ด๋ฉด ์ ์์๋ฅผ
๋ฆฌ์คํธ ์ค๊ฐ ๋๋ ๋์ ์ฝ์ ํ๋ ๊ฒฝ์ฐ์ด๋ค. ๋ฆฌ์คํธ ์ค๊ฐ์ ์ฝ์ ๋๋ ๊ฒฝ์ฐ์๋ ์ ์์๊ฐ ์
ํ ๋ฐ ํ์ ์์๋ฅผ ๋ชจ๋ ๊ฐ์ง๊ฒ ๋์ง๋ง ๋ฆฌ์คํธ ๋ง์ง๋ง์ ์ฝ์ ๋๋ ๊ฒฝ์ฐ์๋ ์ ํ์์๋ง ๊ฐ
์ง๊ฒ ๋๋ค.
public boolean delete(Object item) throws ListUnderflowException{ if(isEmpty()) throw new ListUnderflowException("โฆ"); Comparable x = (Comparable)item; ListNode loc = list; List prevLoc = null; for(int i=0;i<size;i++){ int compResult = x.compareTo(loc.info); if(compResult==0){ // ์ญ์ ํ ๋ ธ๋๊ฐ ์กด์ฌํ๋ ๊ฒฝ์ฐ if(prevLoc==null){ // ์ฒซ ๋ ธ๋๋ฅผ ์ญ์ ํ๋ ๊ฒฝ์ฐ if(loc.next==null) list = null; // ์ญ์ ํ ๋ ธ๋๊ฐ ์ ์ผ ๋ ธ๋์ธ ๊ฒฝ์ฐ else{ loc.next.back = null; list = loc.next; } } else{ prevLoc.next = loc.next; if(loc.next != null) loc.next.back = prevLoc; // ๋ง์ง๋ง ๋ ธ๋๊ฐ ์๋ ๊ฒฝ์ฐ } return true; } else if(compResult<0) return false; else{ prevLoc = loc; loc = loc.next; } } // for return false; }
์์ธ info next
0 David 2
1 null 5
2 John 4
3 Peter 6
4 Mary 3
5 null END
6 Robert END
list 0
class ArrayLinkedList{ public static final int DEF_MAX_CAPACITY = 50; public static final int END = -1; private class ListNode{ public Object info; public int next; } private int list = END; private ListNode[] nodes; private int size = 0; private int free = 0; โฆ }
free 1 size 5
๋ฐ๋ผ์ null ๋์ ์ -1์ ์ด์ฉํ์ฌ ๋ฆฌ์คํธ์ ๋์ ๋ํ๋ธ๋ค.
๋ฐฐ์ด์ ์ด์ฉํ ์ฐ๊ฒฐ๊ตฌ์กฐ์ ๊ตฌํ โ ๊ณ์
info
David
info
John
info
Mary
info
Peter
list info
Robert
free null null
info
David
info
John
info
Peter
list info
Robert
free null null null
Mary์ ์ญ์
๋ณด๋ค ์์ธํ๊ฒ ๊ตฌํ ์๋ฆฌ๋ฅผ ์ดํด๋ณด๋ฉด ๋ฐฐ์ด์ ์ด์ฉํ ์ฐ๊ฒฐ๊ตฌ์กฐ๋ ๋ด๋ถ์ ์ผ๋ก ๋ ๊ฐ์ ๋ฆฌ์คํธ
๋ฅผ ์ ์งํ๋ค. ํ๋๋ ์์๋ค์ด ์ ์ฅ๋์ด ์๋ ์ ํจํ ๋ ธ๋๋ค์ ์ฐ๊ฒฐํด ๋์ ๋ฆฌ์คํธ์ด๊ณ , ๋ค
๋ฅธ ํ๋๋ ์์๋ค์ด ์ ์ฅ๋์ด ์์ง ์์ ๋น ๋ ธ๋๋ฅผ ์ฐ๊ฒฐํด ๋์ ๋ฆฌ์คํธ์ด๋ค. ๋ง์ฝ ์ ์์
๋ฅผ ์ถ๊ฐํด์ผ ํ๋ฉด ๋น ๋ ธ๋๋ค์ ๋ฆฌ์คํธ์์ ํ๋์ ๋ ธ๋๋ฅผ ์ ํํ์ฌ ์ด ๋ ธ๋์ ์ ์์๋ฅผ ๋
์ ํ๊ณ ์ด ๋ ธ๋๋ฅผ ์ ํจํ ๋ ธ๋๋ค์ ๋ฆฌ์คํธ์ ํฌํจํ๋ค. ๋ฐ๋๋ก ๊ธฐ์กด ์์๋ฅผ ์ญ์ ํด์ผ ํ๋ฉด
๊ทธ ๋ ธ๋๋ฅผ ์ ํจํ ๋ ธ๋๋ค์ ๋ฆฌ์คํธ์์ ์ ๊ฑฐํ๊ณ ๋น ๋ ธ๋๋ค์ ๋ฆฌ์คํธ๋ก ์ฎ๊ธด๋ค.
๋ฐฐ์ด์ ์ด์ฉํ ์ฐ๊ฒฐ๊ตฌ์กฐ์ ๊ตฌํ โ ๊ณ์
David John Peter Mary Robert
๋ฐฐ์ด์ ์ด์ฉํ ์ฐ๊ฒฐ ๋ฆฌ์คํธ๋ ์ผ๋ฐ ์ฐ๊ฒฐ ๋ฆฌ์คํธ์ ๋ฌ๋ฆฌ ๋งค๋ฒ ์ฝ์ ํ ๋๋ง๋ค ๊ณต๊ฐ ํ ๋น์ด ์ด
๋ฃจ์ด์ง์ง ์๋๋ค๋ ์ฅ์ ์ ์ง๋๊ณ ์๋ค. ํ์ง๋ง ๋ฐฐ์ด์ ๋ณธ์ง์ ์ธ ํน์ฑ ๋๋ฌธ์ ์ฝ์ ์ฐ์ฐ์
์ ๊ณต๊ฐ์ด ๋ถ์กฑํ ๊ฒฝ์ฐ๋ฅผ ๊ณ ๋ คํด์ผ ํ๋ค.
์์ธ info next
0 john END
1 null 2
2 null 3
3 null 4
4 null 5
5 null 6
6 null END
list 0 free 1 size 1
insert(Robert);
์์ธ info next
0 john 1
1 Robert END
2 null 3
3 null 4
4 null 5
5 null 6
6 null END
list 0 free 2 size 2
int tmp = nodes[free].next; nodes[free].info = item; nodes[free].next = END; nodes[prevLoc].next = free; free = tmp;
loc == END
list 0 free 2 size 2
insert(mary);
์์ธ info next
0 john 2
1 Robert END
2 mary 1
3 null 4
4 null 5
5 null 6
6 null END
list 0 free 3 size 3
int tmp = nodes[free].next; nodes[free].info = item; nodes[free].next = loc; nodes[prevLoc].next = free; free = tmp;
์์ธ info next
0 john 1
1 Robert END
2 null 3
3 null 4
4 null 5
5 null 6
6 null END
list 0 free 3 size 3
insert(Bob);
์์ธ info next
0 john 2
1 Robert END
2 mary 1
3 Bob 0
4 null 5
5 null 6
6 null END
list 3 free 4 size 4
int tmp = nodes[free].next; nodes[free].info = item; nodes[free].next; = loc; list = free; free = tmp;
์์ธ info next
0 john 2
1 Robert END
2 mary 1
3 null 4
4 null 5
5 null 6
6 null END
prevLoc == END
list 3 free 4 size 4
delete(Mary);
์์ธ info next
0 John 1
1 Robert END
2 null 4
3 Bob 0
4 null 5
5 null 6
6 null END
list 3 free 2 size 3
nodes[prevLoc].next = nodes[loc].next; nodes[loc].info = null; nodes[loc].next; = free; free = loc;
์์ธ info next
0 John 2
1 Robert END
2 Mary 1
3 Bob 0
4 null 5
5 null 6
6 null END