The document discusses IEEE 754 binary floating point standard and its implementation in Java floats and doubles. It describes how floats and doubles represent numbers in their sign-exponent-fraction format, including normal and subnormal numbers. It also covers rounding methods and exceptions that can occur in floating point arithmetic like invalid operation, division by zero, overflow, underflow and inexact results.
The SQL parsing process in Oracle typically involves the following procedure calls:
1. Open a cursor
2. Parse the SQL statement
3. Bind variables if needed and determine if the statement is a query
4. If a query, define columns. If not a query, execute the statement directly.
5. Fetch rows and return column values if it is a query.
The document tests the minimum memory requirements for Java Virtual Machines (JVMs) on different operating systems and processor architectures. It finds that for x86 32-bit systems, the minimum memory requirement is 1MB. For x86-64 systems, the minimum is 2MB on Linux but 1MB on Solaris. The minimum for Sparc64 and Aix64 systems is also 2MB. The conclusion is that the minimum JVM memory requirement depends on the specific OS and processor architecture.
The document discusses resolving an ORA-00257 error caused by the archive log destination running out of disk space. Key steps include:
1) Deleting archive log files manually from the OS and using RMAN to remove references
2) Using RMAN to crosscheck and delete expired archive logs
3) This frees up disk space and allows the database to continue archiving logs
Taking these actions resolves the error by freeing space for archiving redo logs.
2. 1Arrays.sort
Arrays ṩ˶Ի bytechardoublefloatintlong
ʵ֡
Arrays ṩ˶ԶıȽϡ
ʵֿɱȽϽӿڵģֱӽбȽϣ
public static void sort(Object[] a)бȽ
ûʵֱȽϽӿڵģһȽȽԽжԸֶ͵ıȽϣ
public static <T> void sort(T[] a,Comparator<? super T> c)
ϵ㷨ṩ,formIndex toIndex С
2int[]ʵ
ͬ int[]
鿴 API Է sort ṩַʵ֣
//Χ
public static void sort(int[] a) {
sort1(a, 0, a.length);
}
//Χ
public static void sort(int[] a, int fromIndex, int toIndex) {
rangeCheck(a.length, fromIndex, toIndex);//˷Χ
sort1(a, fromIndex, toIndex-fromIndex);
}
ͨԿǵº
private static void sort1(int x[], int off, int len)
صú˵
1)У飬֤εЧԣ
##ĺôǣǵļǶջڴʱЧ
##ԣԱѹջĹеʱ䡢ռġӦһֱƼ
##
private static void rangeCheck(int arrayLen, int fromIndex, int toIndex)
{
Zianed Version 1.0 2
3. if (fromIndex > toIndex)
throw new IllegalArgumentException("fromIndex(" + fromIndex +
") > toIndex(" + toIndex+")");
if (fromIndex < 0)
throw new ArrayIndexOutOfBoundsException(fromIndex);
if (toIndex > arrayLen)
throw new ArrayIndexOutOfBoundsException(toIndex);
}
2)Ԫ,ͨм
##ռݽһձʹõķȻʹʱ任ռķһ
##ֻڿռԴȱʹáһΪʱȱռλ
private static void swap(int x[], int a, int b)
{
int t = x[a];
x[a] = x[b];
x[b] = t;
}
3)еһԪ
##± a ʼ n Ԫ± b ʼ n Ԫ,ν swap
##ʵʵݽ
private static void vecswap(int x[], int a, int b, int n)
{
for (int i = 0; i < n; i++, a++, b++)
swap(x, a, b);
}
4)±ԪеռмԪصλá
##ĿݵıȽ
##ֵռмԪصλ
private static int med3(int x[], int a, int b, int c)
{
return (x[a] < x[b] ? (x[b] < x[c] ? b : x[a] < x[c] ? c : a)
: (x[b] > x[c] ? b : x[a] > x[c] ? c : a));
}
ĺ
˵
X[]:Ҫ
Int off:Ԫصʼλ
Int len:ҪԪصĸ
private static void sort1(int x[], int off, int len)
{
Zianed Version 1.0 3
4. // Insertion sort on smallest arrays
##
if (len < 7)
{
for (int i = off; i < len + off; i++)
for (int j = i; j > off && x[j - 1] > x[j]; j--)
swap(x, j, j - 1);
return;
}
// Choose a partition element, v
##ѡָԪv
##ҵλмԪ
int m = off + (len >> 1); // Small arrays, middle element
##ҪԪظ7ʱ
##elseֻе7
if (len > 7)
{
int l = off;
int n = off + len - 1;
if (len > 40)
{
// Big arrays, pseudomedian of 9
int s = len / 8;
l = med3(x, l, l + s, l + 2 * s);
m = med3(x, m - s, m, m + s);
n = med3(x, n - 2 * s, n - s, n);
}
##ȡüмֵ
m = med3(x, l, m, n); // Mid-size, med of 3
}
int v = x[m];
// Establish Invariant: v* (<v)* (>v)* v*
int a = off, b = a, c = off + len - 1, d = c;
##aΪʼԪλ,baͬ,dΪԪλ;cͬd
##a,dǹ̶,Ϊ綨Ԫ;b,cԱ
while (true)
{
while (b <= c && x[b] <= v)
{
Zianed Version 1.0 4
5. if (x[b] == v)
swap(x, a++, b);
b++;
}
while (c >= b && x[c] >= v)
{
if (x[c] == v)
swap(x, c, d--);
c--;
}
if (b > c)
break;
swap(x, b++, c--);
}
// Swap partition elements back to middle
int s, n = off + len;
##
s = Math.min(a - off, b - a);
vecswap(x, off, b - s, s);
##
s = Math.min(d - c, n - d - 1);
vecswap(x, b, n - s, s);
// Recursively sort non-partition-elements
##a-b֮Ԫ
if ((s = b - a) > 1)
sort1(x, off, s);
##cd֮Ԫ
if ((s = d - c) > 1)
sort1(x, n - s, s);
}
ĵıʹõDzõĶԿһָĽֶνв
ҵһģмֵ(ֵϵ)мֵֶν
ֳɵСʹõǿ
Zianed Version 1.0 5
6. 3ʵ˿ɱȽϽӿComparable
бȽ
INSERTIONSORT_THRESHOLD ʾʼ,Сڴٽֵʱ
в
õ 2·鲢
ǰһͺһֱʹȻкϲ
㷨ȶģO nlog2(n)Ч
/**
* used in preference to mergesort or quicksort.
*/
private static final int INSERTIONSORT_THRESHOLD = 7;
private static void mergeSort(Object[] src, Object[] dest,
int low, int high, int off) {
int length = high - low;
// Insertion sort on smallest arrays
if (length < INSERTIONSORT_THRESHOLD) {
for (int i=low; i<high; i++)
for (int j=i; j>low &&
((Comparable) dest[j-1]).compareTo(dest[j])>0; j--)
swap(dest, j, j-1);
return;
}
// Recursively sort halves of dest into src
int destLow = low;
int destHigh = high;
low += off;
high += off;
int mid = (low + high) >>> 1;
##ݹǰһͺһй鲢
mergeSort(dest, src, low, mid, -off);
mergeSort(dest, src, mid, high, -off);
// If list is already sorted, just copy from src to dest. This is an
// optimization that results in faster sorts for nearly ordered lists.
#ǰһͺһֱǰһֵСڵںһСֵôֱӽкϲ
if (((Comparable)src[mid-1]).compareTo(src[mid]) <= 0) {
System.arraycopy(src, low, dest, destLow, length);
return;
}
Zianed Version 1.0 6
7. // Merge sorted halves (now in src) into dest
#ԸöνбȽϵĺϲ
#p ʾǰһε±
#q ʾһε±
for(int i = destLow, p = low, q = mid; i < destHigh; i++) {
#1q>=highʾһѾȫˣǰһʣݸƵĿ
#2p<mid ʾǰһݻʣ࣬ҪԸһݽбȽ
# src[p]<= src[q] ˵ǰһеpСڵqôǰһеpĿ
if (q >= high || p < mid && ((Comparable)src[p]).compareTo(src[q])<=0)
dest[i] = src[p++];
#1p>=midǰһѾȫˣһʣݸƵĿ
#2p<mid ʾǰһݻʣ࣬ҪԸһݽбȽ
# src[p]> src[q] ˵ǰһеpqôƺһеqĿ
else
dest[i] = src[q++];
}
}
/**
* Swaps x[a] with x[b].
*/
private static void swap(Object[] x, int a, int b) {
Object t = x[a];
x[a] = x[b];
x[b] = t;
}
4ûпɱȽԣбȽʱҪ
Ƚ
INSERTIONSORT_THRESHOLD ʾʼ,Сڴٽֵʱ
в
õ 2·鲢
ǰһͺһֱʹȻкϲ
㷨ȶģO nlog2(n)Ч.
㷨ǰͬڱȽϵʱDzõıȽ
private static void mergeSort(Object[] src,
Object[] dest,
int low, int high, int off,
Zianed Version 1.0 7
8. Comparator c) {
int length = high - low;
// Insertion sort on smallest arrays
if (length < INSERTIONSORT_THRESHOLD) {
for (int i=low; i<high; i++)
for (int j=i; j>low && c.compare(dest[j-1], dest[j])>0; j--)
swap(dest, j, j-1);
return;
}
// Recursively sort halves of dest into src
int destLow = low;
int destHigh = high;
low += off;
high += off;
int mid = (low + high) >>> 1;
mergeSort(dest, src, low, mid, -off, c);
mergeSort(dest, src, mid, high, -off, c);
// If list is already sorted, just copy from src to dest. This is an
// optimization that results in faster sorts for nearly ordered lists.
if (c.compare(src[mid-1], src[mid]) <= 0) {
System.arraycopy(src, low, dest, destLow, length);
return;
}
// Merge sorted halves (now in src) into dest
for(int i = destLow, p = low, q = mid; i < destHigh; i++) {
if (q >= high || p < mid && c.compare(src[p], src[q]) <= 0)
dest[i] = src[p++];
else
dest[i] = src[q++];
}
}
5㷨qsortͺϲ㷨
ʵ
Dzȶġ
Zianed Version 1.0 8
9. ϲȶġ
һõ㷨һЩʹõĹгҪȽд˲
public static int binarySearch() ֲǻ
͵㷨
һŵĿı Jon L. Bentley M. Douglas McIlroy
Engineering a Sort Function", Software-Practice and Experience Vol. 23(11) P. 1249-1265
(November 1993)㷨ݼṩ n*log(n) ܣή
ܡ
㷨ԭ
http://www.enseignement.polytechnique.fr/profs/informatique/Luc.Maran
get/421/09/bentley93engineering.pdf
ƪģԿ㷨ĸĽһλȡĽ㷨
һ˼·
References
http://www.docin.com/p-26519551.html
http://hi./helloyanwo/blog/item/bd39af6ce372a1f142169409.html
http://www.cuyoo.com/html/shenghuo/2009/0304/1015.html
http://nknucc.nknu.edu.tw/~jwu/datastr/datastr.htm
http://www.enseignement.polytechnique.fr/profs/informatique/Luc.Maranget/421/09
/bentley93engineering.pdf
http://cs.umaine.edu/~chaw/200801/capstone/n/enggsort.pdf
Zianed Version 1.0 9