20202312郭威 實驗七《查詢與排序》實驗報告
20192312 2020-2021-1 實驗七 《查詢與排序》實驗報告
課程:《程式設計與資料結構》
班級:2023
姓名: 郭威
學號:20202312
實驗教師:王志強
實驗日期:2021年11月4日
必修/選修: 必修
1.實驗內容
1.定義一個Searching和Sorting類,並在類中實現linearSearch,SelectionSort方法,最後完成測試。
要求不少於10個測試用例,提交測試用例設計情況(正常,異常,邊界,正序,逆序),用例資料中要包含自己學號的後四位
提交執行結果圖。
2.重構你的程式碼
把Sorting.java Searching.java放入 cn.edu.besti.cs1823.(姓名首字母+四位學號) 包中(例如:cn.edu.besti.cs1823.G2301)
把測試程式碼放test包中
重新編譯,執行程式碼,提交編譯,執行的截圖(IDEA,命令列兩種)
3.參考http://www.cnblogs.com/maybe2030/p/4715035.html ,學習各種查詢演算法並在Searching中補充查詢演算法並測試
提交執行結果截圖
4.補充實現課上講過的排序方法:希爾排序,堆排序,二叉樹排序等(至少3個)
測試實現的演算法(正常,異常,邊界)
提交執行結果截圖(如果編寫多個排序演算法,即使其中三個排序程式有瑕疵,也可以酌情得滿分)
5.編寫Android程式對實現各種查詢與排序演算法進行測試
提交執行結果截圖
推送程式碼到碼雲(選做,加分)
2.實驗過程及結果
1.定義一個Searching和Sorting類,並在類中實現linearSearch,SelectionSort方法,最後完成測試。
要求不少於10個測試用例,提交測試用例設計情況(正常,異常,邊界,正序,逆序),用例資料中要包含自己學號的後四位
提交執行結果圖。
Searching程式碼
import Week10;
import java.util.Arrays;
import java.util.Scanner;
public class Searching {
int data[];
int top;
public Searching(int m[]){
data=m;
for(top=0;top<data.length&&m[top]!=0;top++);
}
public int[] Input(){
final int CAPACITY=3;
data=new int[CAPACITY];
int i=0;
Scanner scan=new Scanner(System.in);
System.out.print("輸入陣列(以*作為結尾):");
while(scan.hasNextInt()){
if(i==data.length)
data= Arrays.copyOf(data,data.length+CAPACITY);
data[i]=scan.nextInt();
i++;
}
top=i;
scan.next();
return data;
}
public int LinearSearch(int data[],int target){
int m[]=Arrays.copyOf(data,data.length+1);
int i,tail=m.length-1;
m[tail]=target;
for(i=0;;i++){
if(m[i]==target){
if(i==m.length-1)return -1;
else return i+1;
}
}
}
}
Sorting程式碼
package Week10;
import java.util.Arrays;
import java.util.Scanner;
public class Sorting {
int []data;
int top;
public Sorting(int m[]){
data=m;
for(top=0;top<data.length&&m[top]!=0;top++);
}
public void Input() {
final int CAPACITY = 3;
data= new int[CAPACITY];
Scanner scan = new Scanner(System.in);
int i = 0;
System.out.print("輸入陣列(以*作為結尾):");
while (scan.hasNextInt()) {
if (i == data.length)
data = Arrays.copyOf(data, data.length + CAPACITY);
data[i] = scan.nextInt();
i++;
}
top=i;
scan.next();
}
public void swap(int []m,int a,int b){
int temp;
temp=m[a];
m[a]=m[b];
m[b]=temp;
}
public String Print(int m[]){
String a="";
for(int i=0;i<top;i++){
a+=m[i]+" ";
System.out.print(m[i]+" ");
}
System.out.println("");
return a;
}
public String SelectionSort(){
int i,j;
for(i=0;i<top-1;i++){
int temp=i;
for(j=i+1;j<top;j++){
if(data[j]<data[temp])
temp=j;
}
if(temp!=i) {
swap(data, temp, i);
}
}
return Print(data);
}
}
2.重構你的程式碼
把Sorting.java Searching.java放入 cn.edu.besti.cs2023.(姓名首字母+四位學號) 包中(例如:cn.edu.besti.cs2023.G2301)
把測試程式碼放test包中
重新編譯,執行程式碼,提交編譯,執行的截圖(IDEA,命令列兩種)
命令列模式
3.參考http://www.cnblogs.com/maybe2030/p/4715035.html ,學習各種查詢演算法並在Searching中補充查詢演算法並測試
提交執行結果截圖
Node
package cn.edu.besti.cs2023.G2312;
public class Node {
int index;
public int data;//關鍵欄位
public Node leftNode;//左節點
public Node rightNode;//右節點
public Node() {
index=-1;
this.data = -1;
leftNode = null;
rightNode = null;
}
public Node(int value,int i) {
index=i;
this.data = value;
leftNode = null;
rightNode = null;
}
public int findNode(Node root, int key) {
Node current = root;
while (current.data != key) {
if (key < current.data) {//左節點
current = current.leftNode;
} else {//右節點
current = current.rightNode;
}
if (current == null) {
return -1;
}
}
return current.index+1;
}
public Node InsertNode(int m[]) {
Node root = new Node(m[0],0);
int i=1;
while (m[i] != 0 && i < m.length) {
Node current = root;
while(current.data!=m[i]){
if(m[i]<current.data){
if(current.leftNode==null)
current.leftNode=new Node(m[i],i);
current=current.leftNode;
}
else if (m[i]>current.data){
if(current.rightNode==null)
current.rightNode=new Node(m[i],i);
current=current.rightNode;
}
}
i++;
}
return root;
}
}
Searching
package cn.edu.besti.cs2023.G2312;
import java.util.Arrays;
import java.util.Scanner;
public class Searching {
int data[];
int top;
public Searching(int m[]){
data=m;
for(top=0;top<data.length&&m[top]!=0;top++);
}
public int[] Input(){
final int CAPACITY=3;
data=new int[CAPACITY];
int i=0;
Scanner scan=new Scanner(System.in);
System.out.print("輸入陣列(以*作為結尾):");
while(scan.hasNextInt()){
if(i==data.length)
data= Arrays.copyOf(data,data.length+CAPACITY);
data[i]=scan.nextInt();
i++;
}
top=i;
scan.next();
return data;
}
public int LinearSearch(int data[],int target){
int m[]=Arrays.copyOf(data,data.length+1);
int i,tail=m.length-1;
m[tail]=target;
for(i=0;;i++){
if(m[i]==target){
if(i==m.length-1)return -1;
else return i+1;
}
}
}
public int BinarySearch(int t[] ,int min,int max,int target,int i){
int m[]=Arrays.copyOf(t,t.length+1);
int mid=(min+max)/2;
if(i==0) {
Sorting sort=new Sorting(m);
sort.SelectionSort();
}
if(target==m[mid])return mid+1;
else if(target>m[mid]) {
if(mid>=min&&mid<=max)
return BinarySearch(m, mid + 1, max, target, i + 1);
else return -1;
}
else {
if(mid>=min&&mid<=max)
return BinarySearch(m, min, mid - 1, target, i + 1);
else return -1;
}
}
public int InsertSearch(int t[] ,int min,int max,int target,int i){
int m[]=Arrays.copyOf(t,t.length+1);
int mid=min+(target-m[min])/(m[max]-m[min])*(max-min);
if(i==0){
Sorting sort =new Sorting(m);
sort.SelectionSort();
}
if(target==m[mid])return mid+1;
else if(target>m[mid]) {
if(mid>=min&&mid<=max)
return BinarySearch(m, mid + 1, max, target, i + 1);
else return -1;
}
else {
if(mid>=min&&mid<=max)
return BinarySearch(m, min, mid - 1, target, i + 1);
else return -1;
}
}
public int FibonacciSearch(int data[] ,int length,int target){
int low=0;
int high=length-1;
int F[]=new int[20];
int m[]=Arrays.copyOf(data,data.length+1);
Sorting sort=new Sorting(m);
sort.SelectionSort();
Fibonacci(F);//構造一個斐波那契陣列F
int k=0;
while(length>F[k]-1)//計算n位於斐波那契數列的位置
++k;
int [] temp;//將陣列a擴充套件到F[k]-1的長度
temp=Arrays.copyOf(m,F[k]-1);
for(int i=length;i<F[k]-1;++i)
temp[i]=m[length-1];
while(low<=high)
{
int mid=low+F[k-1]-1;
if(target<temp[mid])
{
high=mid-1;
k-=1;
}
else if(target>temp[mid])
{
low=mid+1;
k-=2;
}
else
{
if(mid<length)
return mid+1; //若相等則說明mid即為查詢到的位置
else
return length; //若mid>=n則說明是擴充套件的數值,返回n-1
}
}
return -1;
}
public void Fibonacci(int F[])
{
F[0]=0;
F[1]=1;
for(int i=2;i<20;++i)
F[i]=F[i-1]+F[i-2];
}
public int BinaryTreeSearch(int data[],int target){
int m[]=Arrays.copyOf(data,top+1);
Node node=new Node();
node.InsertNode(m);
return node.findNode(node.InsertNode(m),target);
}
public int HashSearch(int data[] ,int target){
int m[]=HashInsert(data);
int l=m.length;
int i=target%l,j=target%l;
if(target==m[i])return i+1;
for( i=(i+1)%l;i!=j;i=(i+1)%l){
if(target==m[i])return i+1;
}
return -1;
}
public int[] HashInsert(int data[]){
int m[]=new int[top];
int j=0,l=m.length;
for(int i=0;i<l;i++){
j=data[i]%l;
if(m[j]==0)m[j]=data[i];
else{
while(m[j]!=0)j=(j+1)%l;
m[j]=data[i];
}
}
for(j=0;j<l;j++)
System.out.print(m[j]+" ");
System.out.println("");
return m;
}
public int BlockSearch (int data[],int target) throws ArrayIndexOutOfBoundsException{
int n=(top-1)/5+1;
int[][]m= new int [n][5];
int arr[]=Arrays.copyOf(data,top+1);
Sorting sort=new Sorting(arr);
sort.SelectionSort();
int max[]=new int[n];
int t=0;
for(int i=0;i<n;i++) {
int j;
for (j = 0; j < 5; j++) {
m[i][j] = arr[t];
t++;
if(t>=top)break;
}
if(j==5)
max[i]=m[i][4];
else max[i]=arr[t-1];
}
for(t=n-1;t>=0&&target<=max[t];t--);
if(target<arr[0]||target>arr[arr.length-2])return -1;
Searching search=new Searching(m[t+1]);
int p=search.LinearSearch(m[t+1],target);
if(p==-1)return -1;
return 5*(t+1)+p;
}
}
4.補充實現課上講過的排序方法:(至少3個)
測試實現的演算法(正常,異常,邊界)
提交執行結果截圖(如果編寫多個排序演算法,即使其中三個排序程式有瑕疵,也可以酌情得滿分)
package cn.edu.besti.cs2023.G2312;
import java.util.Arrays;
import java.util.Scanner;
public class Sorting {
int []data;
int top;
public Sorting(int m[]){
data=m;
for(top=0;top<data.length&&m[top]!=0;top++);
}
public void Input() {
final int CAPACITY = 3;
data= new int[CAPACITY];
Scanner scan = new Scanner(System.in);
int i = 0;
System.out.print("輸入陣列(以*作為結尾):");
while (scan.hasNextInt()) {
if (i == data.length)
data = Arrays.copyOf(data, data.length + CAPACITY);
data[i] = scan.nextInt();
i++;
}
top=i;
scan.next();
}
public void swap(int []m,int a,int b){
int temp;
temp=m[a];
m[a]=m[b];
m[b]=temp;
}
public String Print(int m[]){
String a="";
for(int i=0;i<top;i++){
a+=m[i]+" ";
System.out.print(m[i]+" ");
}
System.out.println("");
return a;
}
public String SelectionSort(){
int i,j;
for(i=0;i<top-1;i++){
int temp=i;
for(j=i+1;j<top;j++){
if(data[j]<data[temp])
temp=j;
}
if(temp!=i) {
swap(data, temp, i);
}
}
return Print(data);
}
public String ShellSort(){
for(int gap=top/2;gap>0;gap/=2){
for(int i=gap;i<top;i++){
int j=i;
while (j-gap>=0&&data[j]<data[j-gap]){
swap(data,j,j-gap);
j-=gap;
}
}
}
return Print(data);
}
public String InsertSort(){
int len = data.length;
int temp, gap = len / 2;
while (gap > 0) {
for (int i = gap; i < len; i++) {
temp = data[i];
int preIndex = i - gap;
while (preIndex >= 0 && data[preIndex] > temp) {
data[preIndex + gap] = data[preIndex];
preIndex -= gap;
}
data[preIndex + gap] = temp;
}
gap /= 2;
}
return Print(data);
}
public String bubbleSort() {
if (data.length == 0)
return Print(data);
for (int i = 0; i < data.length; i++)
for (int j = 0; j < data.length - 1 - i; j++)
if (data[j + 1] < data[j]) {
int temp = data[j + 1];
data[j + 1] = data[j];
data[j] = temp;
}
return Print(data);
}
}
5.5.編寫Android程式對實現各種查詢與排序演算法進行測試
提交執行結果截圖
推送程式碼到碼雲(選做,加分)
package com.example.searching;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
EditText s1;
EditText s2;
EditText s3;
Button a1;
Button a2;
Button a3;
Button a4;
Button a5;
Button a6;
Button a7;
Button a8;
Button a9;
int d[];
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
s1 = findViewById(R.id.editText);
s2 = findViewById(R.id.editText2);
s3 = findViewById(R.id.editText3);
a1 = findViewById(R.id.button);
a2 = findViewById(R.id.button2);
a3 = findViewById(R.id.button3);
a4 = findViewById(R.id.button4);
a5 = findViewById(R.id.button5);
a6 =findViewById(R.id.button6);
a7 = findViewById(R.id.button7);
a8 = findViewById(R.id.button8);
a9 = findViewById(R.id.button9);
a1.setOnClickListener(select);
a2.setOnClickListener(confirm);
a3.setOnClickListener(shell);
a4.setOnClickListener(linear);
a5.setOnClickListener(binary);
a6.setOnClickListener(blocking);
a7.setOnClickListener(hash);
a8.setOnClickListener(fibonacci);
a9.setOnClickListener(insert);
}
View.OnClickListener select = new View.OnClickListener() {
@Override
public void onClick(View v) {
Sorting sort=new Sorting(d);
s2.setText(sort.SelectionSort());
}
};
View.OnClickListener confirm = new View.OnClickListener() {
@Override
public void onClick(View v) {
String b = s1.getText().toString();
String[] c = b.split(" ");
d = new int[c.length];
for(int i=0;i<c.length;i++)
{
int num = Integer.parseInt(c[i]);
d[i] = num;
}
}
};
View.OnClickListener shell = new View.OnClickListener() {
@Override
public void onClick(View v) {
Sorting sort=new Sorting(d);
s2.setText(sort.ShellSort());
}
};
View.OnClickListener linear = new View.OnClickListener() {
@Override
public void onClick(View v) {
String b1 =s3.getText().toString();
int target = Integer.parseInt(b1);
Searching search=new Searching(d);
int position=search.LinearSearch(d,target);
String result;
if(position==-1)result="Fail!";
else result="Succeed!"+"The position is:"+position;
Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
}
};
View.OnClickListener binary = new View.OnClickListener() {
@Override
public void onClick(View v) {
String b1 =s3.getText().toString();
int target = Integer.parseInt(b1);
Searching search=new Searching(d);
int position=search.BinarySearch(d,0,d.length-1,target,0);
String result;
if(position==-1)result="Fail!";
else result="Succeed!"+"The position is:"+position;
Toast.makeText(getApplicationContext(), new Sorting(d).SelectionSort(), Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
}
};
View.OnClickListener insert = new View.OnClickListener() {
@Override
public void onClick(View v) {
String b1 =s3.getText().toString();
int target = Integer.parseInt(b1);
Searching search=new Searching(d);
int position=search.InsertSearch(d,0,d.length,target,0);
String result;
if(position==-1)result="Fail!";
else result="Succeed!"+"The position is:"+position;
Toast.makeText(getApplicationContext(), new Sorting(d).SelectionSort(), Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
}
};
View.OnClickListener blocking = new View.OnClickListener() {
@Override
public void onClick(View v) {
String b1 =s3.getText().toString();
int target = Integer.parseInt(b1);
Searching search=new Searching(d);
int position=search.BlockSearch(d,target);
String result;
if(position==-1)result="Fail!";
else result="Succeed!"+"The position is:"+position;
Toast.makeText(getApplicationContext(), new Sorting(d).SelectionSort(), Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
}
};
View.OnClickListener hash = new View.OnClickListener() {
@Override
public void onClick(View v) {
String b1 =s3.getText().toString();
int target = Integer.parseInt(b1);
Searching search=new Searching(d);
int position=search.HashSearch(d,target);
String result;
if(position==-1)result="Fail!";
else result="Succeed!"+"The position is:"+position;
Toast.makeText(getApplicationContext(), search.HashPrint(d), Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
}
};
View.OnClickListener fibonacci = new View.OnClickListener() {
@Override
public void onClick(View v) {
String b1 =s3.getText().toString();
int target = Integer.parseInt(b1);
Searching search=new Searching(d);
int position=search.FibonacciSearch(d,d.length,target);
String result;
if(position==-1)result="Fail!";
else result="Succeed!"+"The position is:"+position;
Toast.makeText(getApplicationContext(), new Sorting(d).SelectionSort(), Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
}
};
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/button9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="INSERT"
app:layout_constraintBottom_toTopOf="@+id/button6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.904"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.984" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="64dp"
android:text="Input"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="48dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.454"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="132dp"
android:text="selection"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.268"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="44dp"
android:text="confirm"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.95"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="88dp"
android:layout_marginLeft="88dp"
android:layout_marginTop="132dp"
android:text="shell"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.629"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="220dp"
android:text="Result"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.021"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="76dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.474"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.362" />
<EditText
android:id="@+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:layout_marginBottom="44dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.515"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.557" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:text="@android:string/search_go"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.01"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/editText3"
app:layout_constraintVertical_bias="0.026" />
<Button
android:id="@+id/button6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="blocking"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.912"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.742" />
<Button
android:id="@+id/button8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="160dp"
android:text="Fibonacci"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="52dp"
android:text="binary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.606" />
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="112dp"
android:text="order"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.024"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.565" />
<Button
android:id="@+id/button7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginBottom="160dp"
android:text="hash"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
線性查詢
二叉查詢
插值查詢
分塊查詢
雜湊查詢
3.實驗過程中遇到的問題和解決過程
- 問題1:在重新使用虛擬機器時有些不會,一些命令也不記得了
- 問題1解決方案:網上查詢得到了虛擬機器的一些基本命令。
## 參考資料
- [《Java程式設計與資料結構教程(第二版)》](https://book.douban.com/subject/26851579/)
- [《Java程式設計與資料結構教程(第二版)》學習指導](http://www.cnblogs.com/rocedu/p/5182332.html)
- ...