Skip to content

Commit

Permalink
二叉搜索树ok
Browse files Browse the repository at this point in the history
  • Loading branch information
toly1994328 committed Nov 25, 2018
1 parent 1db20b8 commit 2de1313
Show file tree
Hide file tree
Showing 31 changed files with 500 additions and 107 deletions.
Binary file added DS4Android.apk
Binary file not shown.
4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
}
43 changes: 26 additions & 17 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/icon"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/TranslucentTheme">
<activity
android:name=".ArrayChartActivity"
android:name=".activity.ArrayChartActivity"
android:screenOrientation="landscape">
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN"/>-->
Expand All @@ -19,7 +18,7 @@
<!--</intent-filter>-->
</activity>
<activity
android:name=".SingleLinkedChartActivity"
android:name=".activity.SingleLinkedChartActivity"
android:screenOrientation="landscape">
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN"/>-->
Expand All @@ -29,7 +28,7 @@
</activity>

<activity
android:name=".LinkedChartActivity"
android:name=".activity.LinkedChartActivity"
android:screenOrientation="landscape">
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN"/>-->
Expand All @@ -38,7 +37,7 @@
<!--</intent-filter>-->
</activity>
<activity
android:name=".StackActivity"
android:name=".activity.StackActivity"
android:screenOrientation="landscape">
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN"/>-->
Expand All @@ -48,31 +47,41 @@
</activity>

<activity
android:name=".QueueActivity"
android:name=".activity.QueueActivity"
android:screenOrientation="landscape">
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN"/>-->

<!--<category android:name="android.intent.category.LAUNCHER"/>-->
<!--</intent-filter>-->
</activity>
<activity
android:name=".activity.BinarySearchActivity"
android:screenOrientation="landscape">
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN"/>-->

<!--<category android:name="android.intent.category.LAUNCHER"/>-->
<!--</intent-filter>-->
</activity>
<activity android:name=".BinarySearchActivity"

<activity
android:name=".activity.AVLActivity"
android:screenOrientation="landscape">
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN"/>-->

<!--<category android:name="android.intent.category.LAUNCHER"/>-->
<!--</intent-filter>-->
</activity>
<activity android:name=".activity.home.HomeActivity"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<activity android:name=".AVLActivity"
android:screenOrientation="landscape">
<!--<intent-filter>-->
<!--<action android:name="android.intent.action.MAIN"/>-->

<!--<category android:name="android.intent.category.LAUNCHER"/>-->
<!--</intent-filter>-->
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.toly1994.ds4android;
package com.toly1994.ds4android.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.toly1994.ds4android;
package com.toly1994.ds4android.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.toly1994.ds4android;
package com.toly1994.ds4android.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
Expand All @@ -18,15 +18,15 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

int[] nums = new int[]{
10, 8, 6, 16, 9, 12, 15, 72, 99, 14, 7, 5, 11
10, 66, 6, 2, 8, 1, 17, 55, 4, 3, 5, 99, 15
};


BinarySearchView<Integer> view = new BinarySearchView<>(this);
view.setOnBSTClickListener(new OnBSTClickListener() {
@Override
public void onAdd(BinarySearchView view) {
if (curIndex < nums.length - 1) {
if (curIndex < nums.length) {
view.addData(nums[curIndex]);
curIndex++;

Expand All @@ -36,7 +36,7 @@ public void onAdd(BinarySearchView view) {

@Override
public void onRemove(BinarySearchView view) {
view.remove(8);
view.remove(2);
}

@Override
Expand Down Expand Up @@ -72,13 +72,12 @@ public void onOrder(BinarySearchView view) {
"前序遍历:" + orderPREV.toString() + "\n" +
"中序遍历:" + orderIN.toString() + "\n" +
"后序遍历:" + orderPOST.toString() + "\n"

, Toast.LENGTH_SHORT).show();
}

@Override
public void onContains(BinarySearchView view) {
Toast.makeText(BinarySearchActivity.this, "是否包含8:" + view.contains(8), Toast.LENGTH_SHORT).show();
Toast.makeText(BinarySearchActivity.this, "是否包含4:" + view.contains(4), Toast.LENGTH_SHORT).show();
}
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.toly1994.ds4android;
package com.toly1994.ds4android.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
Expand All @@ -21,8 +21,8 @@ protected void onCreate(Bundle savedInstanceState) {
view.setOnCtrlClickListener(new OnCtrlClickListener<LinkedView<String>>() {
@Override
public void onAdd(LinkedView<String> view) {
view.addData(ZRandom.randomOf3Name());
// view.enqueue(ZRandom.randomCnName());
// view.addData(ZRandom.randomOf3Name());
view.addData(ZRandom.randomCnName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.toly1994.ds4android;
package com.toly1994.ds4android.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.toly1994.ds4android;
package com.toly1994.ds4android.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
Expand All @@ -21,8 +21,8 @@ protected void onCreate(Bundle savedInstanceState) {
view.setOnCtrlClickListener(new OnCtrlClickListener<SingleLinkedView<String>>() {
@Override
public void onAdd(SingleLinkedView<String> view) {
view.addData(ZRandom.randomOf3Name());
// view.enqueue(ZRandom.randomCnName());
// view.addData(ZRandom.randomOf3Name());
view.addData(ZRandom.randomCnName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.toly1994.ds4android;
package com.toly1994.ds4android.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.toly1994.ds4android.activity.home;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;

import com.toly1994.ds4android.R;

import java.util.ArrayList;
import java.util.List;

/**
* 作者:张风捷特烈<br/>
* 时间:2018/11/25 0025:10:50<br/>
* 邮箱:[email protected]<br/>
* 说明:
*/
public class HomeActivity extends AppCompatActivity {

private List<Integer> mData = new ArrayList<>();
private RecyclerView mRecyclerView;


@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mData.add(R.mipmap.array_list);
mData.add(R.mipmap.singel_linked);
mData.add(R.mipmap.linked_list);
mData.add(R.mipmap.stack);
mData.add(R.mipmap.queue);
mData.add(R.mipmap.bst);

setContentView(R.layout.activity_home);

mRecyclerView = findViewById(R.id.id_rv);
mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL));
mRecyclerView.setAdapter(new HomeRVAdapter(this, mData));
}
}
Loading

0 comments on commit 2de1313

Please sign in to comment.