├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml └── runConfigurations.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── google-services.json ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── developers │ │ └── algoexplorer │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ ├── binomialexp.txt │ │ ├── knapsackexp.txt │ │ ├── lcsexp.txt │ │ └── mcmexp.txt │ ├── java │ │ └── com │ │ │ └── developers │ │ │ └── algoexplorer │ │ │ ├── AboutActivity.java │ │ │ ├── Algorithms │ │ │ ├── DynamicProgrammingAlgos.java │ │ │ ├── GraphAlgos.java │ │ │ ├── SearchingAlgos.java │ │ │ └── SortingAlgorithms.java │ │ │ ├── DynamicActivity.java │ │ │ ├── GraphActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── Programs │ │ │ ├── DynamicProgrammingProg.java │ │ │ ├── GraphProgramming.java │ │ │ ├── SearchingPrograms.java │ │ │ └── SortingPrograms.java │ │ │ ├── SearchingActivity.java │ │ │ ├── SortingActivity.java │ │ │ ├── adapters │ │ │ ├── CustomListDynamicAdapter.java │ │ │ ├── CustomListGraphAdapter.java │ │ │ ├── CustomListSearchingAdapter.java │ │ │ ├── CustomListSortingAdapter.java │ │ │ ├── DynamicTabPagerAdapter.java │ │ │ ├── GraphTabPagerAdapter.java │ │ │ ├── SearchTabPagerAdapter.java │ │ │ └── TabPagerAdapter.java │ │ │ └── fragments │ │ │ ├── Algorithm.java │ │ │ ├── Description.java │ │ │ ├── Dynamic.java │ │ │ ├── DynamicAlgorithms.java │ │ │ ├── DynamicDescription.java │ │ │ ├── DynamicExample.java │ │ │ ├── DynamicPrograms.java │ │ │ ├── GraphAlgorithms.java │ │ │ ├── GraphDescription.java │ │ │ ├── GraphPrograms.java │ │ │ ├── Graphs.java │ │ │ ├── Program.java │ │ │ ├── SearchDescription.java │ │ │ ├── SearchPrograms.java │ │ │ ├── Searching.java │ │ │ ├── SearchingAlgorithms.java │ │ │ ├── Sorting.java │ │ │ └── VisualGraph.java │ └── res │ │ ├── drawable-v21 │ │ ├── binarysearch_list.jpg │ │ ├── binomial.png │ │ ├── binomial_list.jpg │ │ ├── bubble.gif │ │ ├── bubblesort_list.jpg │ │ ├── dijkstra_animation.gif │ │ ├── dijkstra_list.gif │ │ ├── floyd_list.jpg │ │ ├── floydwarshall.jpg │ │ ├── heapsort.gif │ │ ├── heapsort_list.jpg │ │ ├── ic_menu_camera.xml │ │ ├── ic_menu_gallery.xml │ │ ├── ic_menu_manage.xml │ │ ├── ic_menu_send.xml │ │ ├── ic_menu_share.xml │ │ ├── ic_menu_slideshow.xml │ │ ├── insertionsort.gif │ │ ├── insertionsort_list.jpg │ │ ├── knapsack.gif │ │ ├── knapsack_list.jpg │ │ ├── lcs.gif │ │ ├── linearsearch_list.jpg │ │ ├── longest_list.jpg │ │ ├── mcm.png │ │ ├── mcm_list.jpg │ │ ├── mergesort.png │ │ ├── mergesort_list.jpg │ │ ├── navbg.jpg │ │ ├── quicksort.gif │ │ ├── quicksort_list.jpg │ │ ├── searchingalgo.gif │ │ ├── selection.gif │ │ └── selectionsort_list.jpg │ │ ├── drawable │ │ ├── binarysearch_list.jpg │ │ ├── binomial.png │ │ ├── binomial_list.jpg │ │ ├── bubble.gif │ │ ├── bubblesort_list.jpg │ │ ├── dijkstra_animation.gif │ │ ├── dijkstra_list.gif │ │ ├── floyd_list.jpg │ │ ├── floydwarshall.jpg │ │ ├── heapsort.gif │ │ ├── heapsort_list.jpg │ │ ├── insertionsort.gif │ │ ├── insertionsort_list.jpg │ │ ├── knapsack.gif │ │ ├── knapsack_list.jpg │ │ ├── lcs.gif │ │ ├── linearsearch_list.jpg │ │ ├── longest_list.jpg │ │ ├── mcm.png │ │ ├── mcm_list.jpg │ │ ├── mergesort.png │ │ ├── mergesort_list.jpg │ │ ├── navbg.jpg │ │ ├── quicksort.gif │ │ ├── quicksort_list.jpg │ │ ├── searchingalgo.gif │ │ ├── selection.gif │ │ ├── selectionsort_list.jpg │ │ └── side_nav_bar.xml │ │ ├── layout │ │ ├── activity_about.xml │ │ ├── activity_dynamic.xml │ │ ├── activity_graph.xml │ │ ├── activity_main.xml │ │ ├── activity_searching.xml │ │ ├── activity_sorting.xml │ │ ├── app_bar_main.xml │ │ ├── content_main.xml │ │ ├── fragment_algorithm.xml │ │ ├── fragment_description.xml │ │ ├── fragment_dynamic.xml │ │ ├── fragment_dynamic_algorithms.xml │ │ ├── fragment_dynamic_description.xml │ │ ├── fragment_dynamic_example.xml │ │ ├── fragment_dynamic_programs.xml │ │ ├── fragment_graph_algorithms.xml │ │ ├── fragment_graph_description.xml │ │ ├── fragment_graph_programs.xml │ │ ├── fragment_graphs.xml │ │ ├── fragment_program.xml │ │ ├── fragment_search_description.xml │ │ ├── fragment_search_programs.xml │ │ ├── fragment_searching.xml │ │ ├── fragment_searching_algorithms.xml │ │ ├── fragment_sorting.xml │ │ ├── fragment_visual_graph.xml │ │ ├── list_dynamic_row.xml │ │ ├── list_graph_row.xml │ │ ├── list_search_row.xml │ │ ├── list_sort_row.xml │ │ └── nav_header_main.xml │ │ ├── menu │ │ ├── activity_main_drawer.xml │ │ └── main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-v21 │ │ └── styles.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── drawables.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── developers │ └── algoexplorer │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── projectFilesBackup └── .idea │ └── workspace.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 1.8 51 | 52 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Algo-Explorer 2 | 3 | Realizing the importance of the subject Algorithm Design in computer science field. 4 | This application is developed keeping in view all type of students so that the learning could be easy. 5 | 6 | The application depicts relevant facts about the most famous algorithms of computer science. The visualization is explained by the help of GIFs. Application also consists of description, programs, examples and the algorithms.
In this version following topic has been covered. 7 | 8 | 1. Sorting-Bubble Sort, Merge Sort, Quick Sort, Heap Sort, Insertion Sort, Selection Sort 9 | 2. Searching - Linear Search, Binary Search 10 | 3. Dynamic Programming- LCS, MCM, 0-1 Knapsack, Binomial coefficient 11 | 4. Graphs- Floyd–Warshall, Dijkstra's algorithm


Download link

IOS version by Bhagat


12 |     

    

    

     13 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion '25.0.0' 6 | 7 | defaultConfig { 8 | applicationId "com.developers.algoexplorer" 9 | minSdkVersion 15 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile group: 'com.google.guava', name: 'guava', version: '15.0' 25 | compile 'com.google.firebase:firebase-database:10.0.1' 26 | compile 'com.google.firebase:firebase-database:10.0.1' 27 | compile 'com.android.support:appcompat-v7:23.4.0' 28 | compile 'com.android.support:design:23.4.0' 29 | compile 'com.android.support:support-v4:23.4.0' 30 | compile 'com.github.bumptech.glide:glide:3.5.2' 31 | compile 'com.google.firebase:firebase-core:10.0.1' 32 | compile 'com.android.support:cardview-v7:23.4.0' 33 | compile 'org.apache.commons:commons-collections4:4.1' 34 | compile 'thereisnospon.codeview:codeview:0.3.1' 35 | compile 'com.diogobernardino:williamchart:2.4.0' 36 | testCompile 'junit:junit:4.12' 37 | compile 'com.google.firebase:firebase-ads:10.0.1' 38 | } 39 | apply plugin: 'com.google.gms.google-services' 40 | 41 | -------------------------------------------------------------------------------- /app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "947514902843", 4 | "firebase_url": "https://algo-explorer.firebaseio.com", 5 | "project_id": "algo-explorer", 6 | "storage_bucket": "algo-explorer.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:947514902843:android:23c6993aee8eb5d9", 12 | "android_client_info": { 13 | "package_name": "com.developers.algoexplorer" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "947514902843-ska5vnkmdu13u9dpj6qq2a6qdjfdg8e0.apps.googleusercontent.com", 19 | "client_type": 3 20 | } 21 | ], 22 | "api_key": [ 23 | { 24 | "current_key":" AIzaSyCItkJco__wuuK3_kR5M9H0ihhT4-tdOX0" 25 | } 26 | ], 27 | "services": { 28 | "analytics_service": { 29 | "status": 1 30 | }, 31 | "appinvite_service": { 32 | "status": 1, 33 | "other_platform_oauth_client": [] 34 | }, 35 | "ads_service": { 36 | "status": 2 37 | } 38 | } 39 | } 40 | ], 41 | "configuration_version": "1" 42 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\Amanjeet Singh\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/developers/algoexplorer/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 27 | 30 | 33 | 36 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/assets/binomialexp.txt: -------------------------------------------------------------------------------- 1 | In above table:- 2 | 1. All entries below C(n,0) are 1 as C(n,0)=1 according to formula 3 | 2. Below C(n,1) for C(1,1) it will be case of C(n ,n)=1.Similarly for C(2,2), C(3,3) and so on. 4 | 3. Let us see values for 2 coefficients:- 5 | C(2,1)=C(1,0)+C(1,1)=1+1=2 6 | C(3,1)=C(2,0)+C(2,1)=1+2=3 7 | C(5,3)=C(4,2)+C(4,3)=6+4=10 8 | These values of C(4,2) and C(4,3) will be pre evaluated similarly. So similarly it will be done for all entries 9 | -------------------------------------------------------------------------------- /app/src/main/assets/knapsackexp.txt: -------------------------------------------------------------------------------- 1 | In above recursion tree, 2 | Input Values : ( 100, 70, 50, 10) 3 | Input weights: (10, 4, 6, 12) 4 | Splitting:- 5 | 1. Root node: For i=3 and w=12 (3,12) 6 | Left: (2, 0) (When item is excluded) 7 | Right: (2, 12) (When item is included) 8 | 2. For( 2,12) 9 | Left: (1, 6) (When 2nd item w=6 is included) 10 | Right: (1, 12) (When 2nd item excluded) 11 | 3. For(1,6) 12 | Left: (0, 2) (When 1st item w=4 is included) 13 | Right: (0, 6) (When 1st item excluded) 14 | 4. For (0,2) 15 | Leaf node (-1, 2) when w=10 not included 16 | 5. For(0,6) 17 | Leaf node (-1, 6) when w=10 not included 18 | 6. For(1,12) 19 | Left: (0, 8) (When 1st item w=4 is included) 20 | Right: (0, 12) (When 1st item excluded) 21 | 7. For (0,8) 22 | Leaf node (-1, 8) when w=10 not included 23 | 8. For (0,12) 24 | Leaf node (-1, 2) when w=10 is included and (-1, 12) when w=10 not included 25 | 26 | Costing: 27 | From below 28 | 1. For (0,6), (0,2), (0,8), (0, 12) m[0,w]=0 29 | 2. For (1,12) Case 3: max(m[0,12], m[0,12]+100)=max(0,100)=100 30 | 3. For (1,6) Case 2: as 10>6 m[0,6]=0 31 | 4. For (2,12) Case 3: max(m[1,12], m[1,2]+70)=max(100,70)=100 32 | 5. For (3,12) Case3:max(m[2,12]+m[2,6]+50)=max(100,120)=120 33 | -------------------------------------------------------------------------------- /app/src/main/assets/lcsexp.txt: -------------------------------------------------------------------------------- 1 | In above table:- 2 | For input X=aab and Y=aba: 3 | 1. We first fill 1st column and 1st row with zero that is when either of m and n are 0. 4 | 2. If X[i]!=Y[j],then check top and left elements and write the maximum from them and put (|,<--) By default : (|). 5 | 3. If X[i]==Y[j] then 1 is added to diagonal element and diagonal arrow is put (\). 6 | 4. For length of LCS and to find LCS. The length of LCS is the last entry of table that is 2 in above case. 7 | 5. To find LCS walk from last entry in direction of arrow entries in reverse order. 8 | In above eg. LCS length=2 9 | LCS is ab 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/assets/mcmexp.txt: -------------------------------------------------------------------------------- 1 | Above shown is the M table evaluated while MCM. 2 | There are 2 matrices S and M produced while solving.The optimized multiplication is evaluated from the S matrix. 3 | Steps to be followed:- 4 | For example: If for the above 5 | n = 6 matrices A1, A2, A3, A4, A5, A6 and their dimensions 30, 35, 15, 5, 10, 20, 25. Then p0=30, p1=35, p2=15, p3=5, p4=10, p5=20, p6=25. 6 | 1.By the formula all the horizontal row of diagonal in the matrix that is m[1,1], m[2,2], m[3,3], m[4,4] and so on will be 0 because for this case i=j. 7 | For this 0 is filled similarly in S matrix. 8 | 2.Now for the rest element we apply the next part of formula. For example: 9 | m[1,2]=m[1,1]+m[2,2]+p0*p1*p2 for k=1. 10 | =0+0+30*35*15=15750 11 | The k value used is filled in S matrix correspondingly that is 1. 12 | m[2,3]=m[2,2]+m[3,3]+p1*p2*p3 for k=2 13 | =0+0+35*15*5=2625 14 | The k value used is filled in S matrix correspondingly that is 2. 15 | For elements like m[1,3] where k can have 2 values that is k=1 or k=2 16 | m[1,3]=min(m[1,1]+m[2,3]+p0*p1*p3, m[1,2]+m[3,3]+p0*p2*p3) 17 | =min(7875,18000)=7875 18 | The k value used is filled in S matrix correspondingly that is 1. 19 | Similarly all the elements of M and S can be evaluated. 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/AboutActivity.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | import android.text.Html; 6 | import android.text.method.LinkMovementMethod; 7 | import android.view.MenuItem; 8 | import android.widget.TextView; 9 | 10 | public class AboutActivity extends AppCompatActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_about); 16 | getSupportActionBar().setDisplayShowHomeEnabled(true); 17 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 18 | getSupportActionBar().setHomeButtonEnabled(true); 19 | TextView about= (TextView) findViewById(R.id.about); 20 | TextView textView =(TextView)findViewById(R.id.link); 21 | String aboutdesc=getResources().getString(R.string.about_desc); 22 | textView.setClickable(true); 23 | textView.setMovementMethod(LinkMovementMethod.getInstance()); 24 | String text = " Github Link "; 25 | textView.setText(Html.fromHtml(text)); 26 | about.setText(aboutdesc); 27 | } 28 | @Override 29 | public boolean onOptionsItemSelected(MenuItem item) { 30 | int id = item.getItemId(); 31 | if (id == android.R.id.home) { 32 | finish(); 33 | return true; 34 | } 35 | return super.onOptionsItemSelected(item); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/Algorithms/DynamicProgrammingAlgos.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.Algorithms; 2 | 3 | /** 4 | * Created by Amanjeet Singh on 19-Jan-17. 5 | */ 6 | 7 | public class DynamicProgrammingAlgos { 8 | public static final String knapsackalgo="// Input:\n" + 9 | "// Values(stored in array v)\n" + 10 | "// Weights(stored in array w)\n" + 11 | "// Number of distinct items(n)\n" + 12 | "// Knapsack capacity(W)\n" + 13 | "for i from 1 to n do\n"+ 14 | "m[i, 0] := 0"+ 15 | "for j from 0 to W do\n" + 16 | "m[0, j] := 0\n" + 17 | "end for\n" + 18 | "for i from 1 to n do\n" + 19 | "for j from 0 to W do\n" + 20 | "if w[i] <= j then\n" + 21 | "m[i,j]:=max(m[i-1, j], m[i-1, j-w[i]] + v[i])\n" + 22 | "else\n" + 23 | "m[i,j]:=m[i-1, j]\n" + 24 | "end if\n" + 25 | "end for\n" + 26 | "end for"; 27 | public static final String binomialalgo="if (k == 0 || k == n) /* base caseS */\n" + 28 | " return 1;\n" + 29 | "else /* recursive caseS */\n" + 30 | " return C(n-1, k-1) +" + 31 | "C(n-1, k);"; 32 | public static final String lcsalgo="LCS-Length(X, Y)\n" + 33 | "\n" + 34 | "m <- length[X]\n" + 35 | "n <- length[Y]\n" + 36 | "\n" + 37 | "for i <- 1 to m\n" + 38 | " c[i,0] <- 0\n" + 39 | "for j <- 1 to n\n" + 40 | " c[0,j] <- 0\n" + 41 | "\n" + 42 | "for i <- 1 to m\n" + 43 | " for j <- 1 to n\n" + 44 | " if (x_i == y_j) {\n" + 45 | " c[i,j] <- c[i-1,j-1] + 1\n" + 46 | " b[i,j] <- NW\n" + 47 | " }\n" + 48 | " else if (c[i-1,j] >= c[i,j-1]) {\n" + 49 | " c[i,j] <- c[i-1,j]\n" + 50 | " b[i,j] <- N\n" + 51 | " }\n" + 52 | " else {\n" + 53 | " c[i,j] <- c[i,j-1]\n" + 54 | " b[i,j] <- W\n" + 55 | " }"; 56 | public static final String mcmalgo="Matrix-Chain(array p[1 .. n], int n) {\n" + 57 | "Array s[1 .. n − 1, 2 .. n];\n" + 58 | "FOR i = 1 TO n DO m[i, i] = 0;\n" + 59 | "FOR L = 2 TO n DO {\n" + 60 | " FOR i = 1 TO n − L + 1 do {\n" + 61 | " j = i + L − 1;\n" + 62 | " m[i, j] = infinity;\n" + 63 | " FOR k = i TO j − 1 DO {\n" + 64 | " q = m[i, k] + m[k + 1, j] + p[i − 1] p[k] p[j];\n" + 65 | " IF (q < m[i, j]) {\n" + 66 | " m[i, j] = q;\n" + 67 | " s[i, j] = k;\n" + 68 | "}\n" + 69 | "}\n" + 70 | "}\n" + 71 | "}\n" + 72 | "return m[1, n](final cost) and s (splitting markers);\n" + 73 | "}"; 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/Algorithms/GraphAlgos.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.Algorithms; 2 | 3 | /** 4 | * Created by Amanjeet Singh on 23-Jan-17. 5 | */ 6 | 7 | public class GraphAlgos { 8 | public static final String floydalgo="for i = 1 to N\n" + 9 | "for j = 1 to N\n" + 10 | "if there is an edge from i to j\n" + 11 | " dist[0][i][j] = the length of the edge from i to j\n" + 12 | "else\n" + 13 | " dist[0][i][j] = INFINITY\n" + 14 | "\n" + 15 | "for k = 1 to N\n" + 16 | " for i = 1 to N\n" + 17 | " for j = 1 to N\n" + 18 | " dist[k][i][j] = min(dist[k-1][i][j], dist[k-1][i][k] + dist[k-1][k][j])"; 19 | public static final String dijalgo="function Dijkstra(Graph, source):\n" + 20 | "for each vertex v in Graph: // Initialization\n" + 21 | " dist[v] := infinity // initial distance from source to vertex v is set to infinite\n" + 22 | " previous[v] := undefined // Previous node in optimal path from source\n" + 23 | " dist[source] := 0 // Distance from source to source\n" + 24 | " Q := the set of all nodes in Graph \t// all nodes in the graph are unoptimized - thus are in Q\n" + 25 | "while Q is not empty: // main loop\n" + 26 | " tu := node in Q with smallest dist[ ]\n" + 27 | " remove u from Q\n" + 28 | " for each neighbor v of u: // where v has not yet been removed from Q.\n" + 29 | " alt := dist[u] + dist_between(u, v)\n" + 30 | " if alt < dist[v]// Relax (u,v)\n" + 31 | " dist[v] := alt\n" + 32 | " previous[v] := u\n" + 33 | "return previous[ ] "; 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/Algorithms/SearchingAlgos.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.Algorithms; 2 | 3 | /** 4 | * Created by Amanjeet Singh on 17-Jan-17. 5 | */ 6 | 7 | public class SearchingAlgos { 8 | public static final String BINARY_SEARCH_ALGORITHM="function binarySearch(a, value, left, right)\n" + 9 | "if right < left\n" + 10 | " return not found\n" + 11 | "mid := floor((right-left)/2)+left\n" + 12 | "if a[mid] = value\n" + 13 | " return mid\n" + 14 | "if value < a[mid]\n" + 15 | " return binarySearch(a, value, left, mid-1)\n" + 16 | "else\n" + 17 | " return binarySearch(a, value, mid+1, right)\n"+ 18 | "//mid determines the index of a given value"; 19 | public static final String LINEAR_SEARCH_ALGORITHM="//Input: Array D, integer key\n" + 20 | "// Output: returns i when found,\n//or -1 if not found\n" + 21 | "\n" + 22 | " For i = 0 to last index of D:\n" + 23 | " if D[i] equals key:\n" + 24 | " return i\n" + 25 | " return -1 //if not found\n"; 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/Algorithms/SortingAlgorithms.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.Algorithms; 2 | 3 | /** 4 | * Created by Amanjeet Singh on 16-Jan-17. 5 | */ 6 | 7 | public class SortingAlgorithms { 8 | public static final String BUBBLE_SORT_ALGO="begin BubbleSort(list)\n" + 9 | "\n" + 10 | "for all elements of list\n" + 11 | "if list[i] > list[i+1]\n" + 12 | " swap(list[i], list[i+1])\n" + 13 | "end if\n" + 14 | "end for\n" + 15 | "\n" + 16 | "return list\n" + 17 | "\n" + 18 | "end BubbleSort"; 19 | public static final String MERGE_SORT_ALGO="mergeSort(array, first, last):\n" + 20 | "//sort array[first] to array[last-1]\n" + 21 | "if last - first <= 1:\n" + 22 | "return //length 0 or 1 already sorted\n" + 23 | "\n" + 24 | "mid = (first + last)/2\n" + 25 | "mergeSort(array, first, mid) //recursive call 1\n" + 26 | "mergeSort(array, mid, last) //recursive call 2\n" + 27 | "merge(array, first, mid, last)\n\n" + 28 | "merge(array, first, mid, last):\n" + 29 | "//merge array[first to mid-1] and array[mid to last-1]\n" + 30 | "leftpos = first\n" + 31 | "rightpos = mid\n" + 32 | "for newpos from 0 to last-first:\n" + 33 | "if array[leftpos] <= array[rightpos]:\n" + 34 | " newarray[newpos] = array[leftpos]\n" + 35 | " leftpos++\n" + 36 | "else:\n" + 37 | " newarray[newpos] = array[rightpos]\n" + 38 | " rightpos++\n" + 39 | " copy newarray to array[first to (last-1)]"; 40 | public static final String INSERTION_SORT_ALGORITHM="INSERTION_SORT (A)\n" + 41 | "\n" + 42 | "1.FOR j ← 2 TO length[A]\n" + 43 | "2.DO key ← A[j] \n" + 44 | "3.{Put A[j] into the sorted sequence A[1 . . j − 1]} \n" + 45 | "4.i ← j − 1 \n" + 46 | "5.WHILE i > 0 and A[i] > key\n" + 47 | "6.DO A[i +1] ← A[i] \n" + 48 | "7.i ← i − 1 \n" + 49 | "8.A[i + 1] ← key"; 50 | public static final String QUICK_SORT_ALGORITHM="Quicksort(A as array, low as int, high as int){\n" + 51 | "if (low < high){\n" + 52 | "pivot_location = Partition(A,low,high)\n" + 53 | "Quicksort(A,low, pivot_location)\n" + 54 | "Quicksort(A, pivot_location + 1, high)\n" + 55 | "}\n" + 56 | "}\n" + 57 | "Partition(A as array, low as int, high as int){\n" + 58 | "pivot = A[low]\n" + 59 | "leftwall = low\n" + 60 | "\n" + 61 | "for i = low + 1 to high{\n" + 62 | "if (A[i] < pivot) then{\n" + 63 | "swap(A[i], A[leftwall])\n" + 64 | "leftwall = leftwall + 1\n" + 65 | "}\n" + 66 | "}\n" + 67 | "swap(pivot,A[leftwall])\n" + 68 | "\n" + 69 | "return (leftwall)}"; 70 | public static final String HEAP_SORT_ALGORITHM="MaxHeapify(A, i)\n" + 71 | "l = left(i)\n" + 72 | "r = right(i)\n" + 73 | "if l <= heap-size[A] and A[l] > A[i]\n" + 74 | "then largest = l\n" + 75 | "else largest = i\n" + 76 | "if r <= heap-size[A] and A[r] > A[largest]\n" + 77 | " then largest = r\n" + 78 | " if largest != i\n" + 79 | " then swap A[i] with A[largest]\n" + 80 | " MaxHeapify(A, largest)\n" + 81 | "end func\n" + 82 | " \n" + 83 | "BuildMaxHeap(A)\n" + 84 | "heap-size[A] = length[A]\n" + 85 | "for i = |length[A]/2| downto 1\n" + 86 | "do MaxHeapify(A, i)\n" + 87 | "end func\n" + 88 | " \n" + 89 | "HeapSort(A)\n" + 90 | "BuildMaxHeap(A)\n" + 91 | "for i = length[A] downto 2\n" + 92 | "do swap A[1] with A[i]\n" + 93 | "heap-size[A] = heap-size[A] – 1\n" + 94 | "MaxHeapify(A, 1)\n" + 95 | "end func"; 96 | public static final String SELECTION_SORT_ALGORITHM="SELECTION-SORT(A)\n" + 97 | "1.for j ← 1 to n-1\n" + 98 | "2. smallest ← j\n" + 99 | "3.for i ← j + 1 to n\n" + 100 | "4. if A[ i ] < A[ smallest ]\n" + 101 | "5. smallest ← i\n" + 102 | "6. Exchange A[ j ] ↔ A[ smallest ]"; 103 | 104 | } 105 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/GraphActivity.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer; 2 | 3 | import android.support.design.widget.TabLayout; 4 | import android.support.v4.view.ViewPager; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.os.Bundle; 7 | import android.util.Log; 8 | import android.view.MenuItem; 9 | import android.widget.ImageView; 10 | import android.widget.TextView; 11 | 12 | import com.bumptech.glide.Glide; 13 | import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; 14 | import com.developers.algoexplorer.adapters.GraphTabPagerAdapter; 15 | 16 | public class GraphActivity extends AppCompatActivity { 17 | private ViewPager mPager4; 18 | private TabLayout graphtab; 19 | private static String graphtitle; 20 | private GraphTabPagerAdapter graphTabPagerAdapter; 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_graph); 25 | mPager4= (ViewPager) findViewById(R.id.pager3); 26 | graphtab= (TabLayout) findViewById(R.id.tab3); 27 | Bundle extras=getIntent().getExtras(); 28 | graphtitle=extras.getString("graphname"); 29 | switch (graphtitle){ 30 | case "Floyd–Warshall algorithm": 31 | Glide.with(this).load(R.drawable.floydwarshall).into(new GlideDrawableImageViewTarget((ImageView) findViewById(R.id.gifgraph))); 32 | break; 33 | case "Dijkstra's algorithm": 34 | Glide.with(this).load(R.drawable.dijkstra_animation).into(new GlideDrawableImageViewTarget((ImageView) findViewById(R.id.gifgraph))); 35 | break; 36 | } 37 | graphtab.addTab(graphtab.newTab().setText("Description")); 38 | graphtab.addTab(graphtab.newTab().setText("Programs")); 39 | graphtab.addTab(graphtab.newTab().setText("Algorithms")); 40 | graphTabPagerAdapter=new GraphTabPagerAdapter(getSupportFragmentManager()); 41 | mPager4.setAdapter(graphTabPagerAdapter); 42 | mPager4.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(graphtab)); 43 | graphtab.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { 44 | @Override 45 | public void onTabSelected(TabLayout.Tab tab) { 46 | mPager4.setCurrentItem(tab.getPosition()); 47 | } 48 | 49 | @Override 50 | public void onTabUnselected(TabLayout.Tab tab) { 51 | 52 | } 53 | 54 | @Override 55 | public void onTabReselected(TabLayout.Tab tab) { 56 | 57 | } 58 | }); 59 | } 60 | @Override 61 | public boolean onOptionsItemSelected(MenuItem item) { 62 | int id = item.getItemId(); 63 | if (id == android.R.id.home) { 64 | finish(); 65 | return true; 66 | } 67 | return super.onOptionsItemSelected(item); 68 | } 69 | public static String getGraphtitle(){ 70 | return graphtitle; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.design.widget.FloatingActionButton; 6 | import android.support.design.widget.Snackbar; 7 | import android.support.v4.app.Fragment; 8 | import android.support.v4.app.FragmentManager; 9 | import android.support.v4.app.FragmentTransaction; 10 | import android.view.View; 11 | import android.support.design.widget.NavigationView; 12 | import android.support.v4.view.GravityCompat; 13 | import android.support.v4.widget.DrawerLayout; 14 | import android.support.v7.app.ActionBarDrawerToggle; 15 | import android.support.v7.app.AppCompatActivity; 16 | import android.support.v7.widget.Toolbar; 17 | import android.view.Menu; 18 | import android.view.MenuItem; 19 | 20 | import com.developers.algoexplorer.fragments.Dynamic; 21 | import com.developers.algoexplorer.fragments.Graphs; 22 | import com.developers.algoexplorer.fragments.Searching; 23 | import com.developers.algoexplorer.fragments.Sorting; 24 | import com.developers.algoexplorer.fragments.VisualGraph; 25 | import com.google.android.gms.ads.MobileAds; 26 | 27 | public class MainActivity extends AppCompatActivity 28 | implements NavigationView.OnNavigationItemSelectedListener { 29 | Fragment mFragment; 30 | @Override 31 | protected void onCreate(Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | setContentView(R.layout.activity_main); 34 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 35 | setSupportActionBar(toolbar); 36 | mFragment=null; 37 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); 38 | ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( 39 | this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); 40 | drawer.setDrawerListener(toggle); 41 | toggle.syncState(); 42 | NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); 43 | navigationView.setNavigationItemSelectedListener(this); 44 | mFragment=new Sorting(); 45 | if(mFragment!=null){ 46 | FragmentManager fragmentManager=getSupportFragmentManager(); 47 | FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction(); 48 | fragmentTransaction.replace(R.id.container_body,mFragment); 49 | fragmentTransaction.commit(); 50 | getSupportActionBar().setTitle(R.string.menu_sorting); 51 | } 52 | 53 | MobileAds.initialize(MainActivity.this,"ca-app-pub-3940256099942544~3347511713"); 54 | } 55 | 56 | @Override 57 | public void onBackPressed() { 58 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); 59 | if (drawer.isDrawerOpen(GravityCompat.START)) { 60 | drawer.closeDrawer(GravityCompat.START); 61 | } else { 62 | super.onBackPressed(); 63 | } 64 | } 65 | 66 | @Override 67 | public boolean onCreateOptionsMenu(Menu menu) { 68 | // Inflate the menu; this adds items to the action bar if it is present. 69 | getMenuInflater().inflate(R.menu.main, menu); 70 | return true; 71 | } 72 | 73 | @Override 74 | public boolean onOptionsItemSelected(MenuItem item) { 75 | // Handle action bar item clicks here. The action bar will 76 | // automatically handle clicks on the Home/Up button, so long 77 | // as you specify a parent activity in AndroidManifest.xml. 78 | int id = item.getItemId(); 79 | 80 | //noinspection SimplifiableIfStatement 81 | if (id == R.id.action_about) { 82 | Intent intent=new Intent(this,AboutActivity.class); 83 | startActivity(intent); 84 | return true; 85 | } 86 | 87 | return super.onOptionsItemSelected(item); 88 | } 89 | 90 | @SuppressWarnings("StatementWithEmptyBody") 91 | @Override 92 | public boolean onNavigationItemSelected(MenuItem item) { 93 | // Handle navigation view item clicks here. 94 | int id = item.getItemId(); 95 | Fragment fragment=null; 96 | if (id == R.id.nav_camera) { 97 | fragment=new Sorting(); 98 | getSupportActionBar().setTitle("Sorting"); 99 | } else if (id == R.id.nav_gallery) { 100 | fragment=new Searching(); 101 | getSupportActionBar().setTitle("Searching"); 102 | } else if (id == R.id.nav_slideshow) { 103 | fragment=new Dynamic(); 104 | getSupportActionBar().setTitle("Dynamic Programming"); 105 | } else if (id == R.id.nav_manage) { 106 | fragment=new Graphs(); 107 | getSupportActionBar().setTitle("Graphs"); 108 | } else if (id == R.id.nav_share) { 109 | fragment=new VisualGraph(); 110 | getSupportActionBar().setTitle("Complexity Plot"); 111 | } 112 | if(fragment!=null){ 113 | FragmentManager fragmentManager=getSupportFragmentManager(); 114 | FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction(); 115 | fragmentTransaction.replace(R.id.container_body,fragment); 116 | fragmentTransaction.commit(); 117 | } 118 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); 119 | drawer.closeDrawer(GravityCompat.START); 120 | return true; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/Programs/GraphProgramming.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.Programs; 2 | 3 | /** 4 | * Created by Amanjeet Singh on 23-Jan-17. 5 | */ 6 | 7 | public class GraphProgramming { 8 | public static final String floydpro="#include \n" + 9 | "using namespace std;\n" + 10 | "\n" + 11 | "void floyds(int b[][7])\n" + 12 | "{\n" + 13 | " int i, j, k;\n" + 14 | " for (k = 0; k < 7; k++)\n" + 15 | " {\n" + 16 | " for (i = 0; i < 7; i++)\n" + 17 | "{\n" + 18 | "for (j = 0; j < 7; j++)\n" + 19 | "{\n" + 20 | "if ((b[i][k] * b[k][j] != 0) && (i != j))\n" + 21 | "{\n" + 22 | "if ((b[i][k] + b[k][j] < b[i][j]) || (b[i][j] == 0))\n" + 23 | "{\n" + 24 | "b[i][j] = b[i][k] + b[k][j];\n" + 25 | " }\n" + 26 | "}\n" + 27 | " }\n" + 28 | "}\n" + 29 | "}\n" + 30 | "for (i = 0; i < 7; i++)\n" + 31 | "{\n" + 32 | " cout<<\"nMinimum Cost With Respect to Node:\"<>b[i][j];\n" + 48 | "}\n" + 49 | "floyds(b);\n" + 50 | "return 0;\n" + 51 | "}"; 52 | public static final String dijpro="#include\n" + 53 | "#include\n" + 54 | "#include\n" + 55 | "using namespace std;\n" + 56 | "int shortest(int ,int);\n" + 57 | "int cost[10][10],dist[20],i,j,n,k,m,S[20],v,totcost,path[20],p;\n" + 58 | "main()\n" + 59 | "{\n" + 60 | "int c;\n" + 61 | "cout <<\"enter no of vertices\";\n" + 62 | "cin >> n;\n" + 63 | "cout <<\"enter no of edges\"; \n" + 64 | "cin >>m;\n" + 65 | "cout <<\"\\nenter\\nEDGE Cost\\n\";\n" + 66 | "for(k=1;k<=m;k++)\n" + 67 | "{\n" + 68 | "cin >> i >> j >>c;\n" + 69 | "cost[i][j]=c;\n" + 70 | "}\n" + 71 | "for(i=1;i<=n;i++)\n" + 72 | "for(j=1;j<=n;j++)\n" + 73 | "if(cost[i][j]==0)\n" + 74 | "cost[i][j]=31999;\n" + 75 | "cout <<\"enter initial vertex\";\n" + 76 | "cin >>v;\n" + 77 | "cout << v<<\"\\n\";\n" + 78 | "shortest(v,n);\n" + 79 | " }\n" + 80 | " \n" + 81 | "int shortest(int v,int n)\n" + 82 | "{\n" + 83 | "int min;\n" + 84 | "for(i=1;i<=n;i++)\n" + 85 | "{\n" + 86 | "S[i]=0;\n" + 87 | "dist[i]=cost[v][i];\n" + 88 | "}\n" + 89 | "path[++p]=v;\n" + 90 | "S[v]=1;\n" + 91 | "dist[v]=0;\n" + 92 | "for(i=2;i<=n-1;i++)\n" + 93 | "{\n" + 94 | "k=-1;\n" + 95 | "min=31999;\n" + 96 | "for(j=1;j<=n;j++)\n" + 97 | "{\n" + 98 | "if(dist[j]=dist[k]+cost[k][j] && S[j]!=1)\n" + 114 | " dist[j]=dist[k]+cost[k][j];\n" + 115 | "}\n" + 116 | "}"; 117 | 118 | } 119 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/Programs/SearchingPrograms.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.Programs; 2 | 3 | /** 4 | * Created by Amanjeet Singh on 17-Jan-17. 5 | */ 6 | 7 | public class SearchingPrograms { 8 | public static final String LINEAR_SEARCH_PROGRAM="/* C++ Program - Linear Search */\n" + 9 | "\t\t\n" + 10 | "#include\n" + 11 | "#include\n" + 12 | "void main()\n" + 13 | "{\n" + 14 | "clrscr();\n" + 15 | "int arr[10], i, num, n, c=0, pos;\n" + 16 | "cout<<\"Enter the array size : \";\n" + 17 | "cin>>n;\n" + 18 | "cout<<\"Enter Array Elements : \";\n" + 19 | "for(i=0; i>arr[i];\n" + 22 | "}\n" + 23 | "cout<<\"Enter number to be search:\";\n" + 24 | "cin>>num;\n" + 25 | "for(i=0; i\n" + 46 | "void main()\n" + 47 | "{\n" + 48 | "clrscr();\n" + 49 | "int n, i, arr[50], search, first, last, middle;\n" + 50 | "cout<<\"Enter total number of elements :\";\n" + 51 | "cin>>n;\n" + 52 | "cout<<\"Enter \"<>arr[i];\n" + 56 | "}\n" + 57 | "cout<<\"Enter a number to find :\";\n" + 58 | "cin>>search;\n" + 59 | "first = 0;\n" + 60 | "last = n-1;\n" + 61 | "middle = (first+last)/2;\n" + 62 | "while (first <= last)\n" + 63 | "{\n" + 64 | "if(arr[middle] < search)\n" + 65 | "{\n" + 66 | "first = middle + 1;\n" + 67 | "\n" + 68 | "}\n" + 69 | "else if(arr[middle] == search)\n" + 70 | "{\n" + 71 | "cout<<\"found at \"< last)\n" + 81 | "{\n" + 82 | "cout<<\"Not found!\";\n"+ 83 | "}\n" + 84 | "getch();\n" + 85 | "}"; 86 | } 87 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/SearchingActivity.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer; 2 | 3 | import android.support.design.widget.TabLayout; 4 | import android.support.v4.view.ViewPager; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.os.Bundle; 7 | import android.view.MenuItem; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import com.bumptech.glide.Glide; 12 | import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; 13 | import com.developers.algoexplorer.adapters.SearchTabPagerAdapter; 14 | 15 | public class SearchingActivity extends AppCompatActivity { 16 | private ViewPager mPager2; 17 | private TabLayout searchtab; 18 | private static String search; 19 | private static int img=R.drawable.searchingalgo; 20 | private SearchTabPagerAdapter searchTabPagerAdapter; 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_searching); 25 | mPager2=(ViewPager)findViewById(R.id.pager1); 26 | searchtab=(TabLayout)findViewById(R.id.tab1); 27 | Bundle bundle=getIntent().getExtras(); 28 | search=bundle.getString("searchname"); 29 | switch(search){ 30 | case "Linear Search": 31 | Glide.with(this).load(img).into(new GlideDrawableImageViewTarget((ImageView) findViewById(R.id.gif1))); 32 | break; 33 | case "Binary Search": 34 | Glide.with(this).load(img).into(new GlideDrawableImageViewTarget((ImageView) findViewById(R.id.gif1))); 35 | break; 36 | } 37 | searchtab.addTab(searchtab.newTab().setText("Description")); 38 | searchtab.addTab(searchtab.newTab().setText("Program")); 39 | searchtab.addTab(searchtab.newTab().setText("Algorithm")); 40 | searchTabPagerAdapter=new SearchTabPagerAdapter(getSupportFragmentManager()); 41 | mPager2.setAdapter(searchTabPagerAdapter); 42 | mPager2.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(searchtab)); 43 | searchtab.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { 44 | @Override 45 | public void onTabSelected(TabLayout.Tab tab) { 46 | mPager2.setCurrentItem(tab.getPosition()); 47 | } 48 | 49 | @Override 50 | public void onTabUnselected(TabLayout.Tab tab) { 51 | 52 | } 53 | 54 | @Override 55 | public void onTabReselected(TabLayout.Tab tab) { 56 | 57 | } 58 | }); 59 | } 60 | @Override 61 | public boolean onOptionsItemSelected(MenuItem item) { 62 | int id = item.getItemId(); 63 | if (id == android.R.id.home) { 64 | finish(); 65 | return true; 66 | } 67 | return super.onOptionsItemSelected(item); 68 | } 69 | public static String getSearchName(){ 70 | return search; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/SortingActivity.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.BitmapFactory; 5 | import android.graphics.Color; 6 | import android.os.AsyncTask; 7 | import android.support.design.widget.TabLayout; 8 | import android.support.v4.view.ViewPager; 9 | import android.support.v7.app.AppCompatActivity; 10 | import android.os.Bundle; 11 | import android.util.Log; 12 | import android.view.MenuItem; 13 | import android.view.MotionEvent; 14 | import android.view.View; 15 | import android.widget.ImageView; 16 | import android.widget.ProgressBar; 17 | import android.widget.TextView; 18 | 19 | import com.bumptech.glide.Glide; 20 | import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; 21 | import com.developers.algoexplorer.adapters.TabPagerAdapter; 22 | import com.developers.algoexplorer.fragments.Description; 23 | import com.google.firebase.database.DataSnapshot; 24 | import com.google.firebase.database.DatabaseError; 25 | import com.google.firebase.database.DatabaseReference; 26 | import com.google.firebase.database.FirebaseDatabase; 27 | import com.google.firebase.database.ValueEventListener; 28 | 29 | 30 | import org.json.JSONArray; 31 | import org.json.JSONException; 32 | import org.json.JSONObject; 33 | 34 | import java.io.ByteArrayOutputStream; 35 | import java.util.ArrayList; 36 | import java.util.HashMap; 37 | import java.util.Iterator; 38 | 39 | public class SortingActivity extends AppCompatActivity{ 40 | private ViewPager mPager; 41 | private TabLayout tab; 42 | private ProgressBar progressBar; 43 | private static String title; 44 | private static int images[]=new int[]{R.drawable.bubble,R.drawable.mergesort,R.drawable.insertionsort,R.drawable.quicksort, 45 | R.drawable.heapsort,R.drawable.selection}; 46 | 47 | private TabPagerAdapter tabPagerAdapter; 48 | @Override 49 | protected void onCreate(Bundle savedInstanceState) { 50 | super.onCreate(savedInstanceState); 51 | setContentView(R.layout.activity_sorting); 52 | mPager= (ViewPager) findViewById(R.id.pager); 53 | tab=(TabLayout)findViewById(R.id.tab); 54 | progressBar= (ProgressBar) findViewById(R.id.prog); 55 | progressBar.setVisibility(View.VISIBLE); 56 | Bundle extras=getIntent().getExtras(); 57 | title=extras.getString("sortname"); 58 | switch (title){ 59 | case "Bubble Sort": 60 | Glide.with(this).load(images[0]).into(new GlideDrawableImageViewTarget((ImageView) findViewById(R.id.gif))); 61 | break; 62 | case "Merge Sort": 63 | Glide.with(this).load(images[1]).into(new GlideDrawableImageViewTarget((ImageView) findViewById(R.id.gif))); 64 | break; 65 | case "Insertion Sort": 66 | Glide.with(this).load(images[2]).into(new GlideDrawableImageViewTarget((ImageView) findViewById(R.id.gif))); 67 | break; 68 | case "Quick Sort": 69 | Glide.with(this).load(images[3]).into(new GlideDrawableImageViewTarget((ImageView) findViewById(R.id.gif))); 70 | break; 71 | case "Heap Sort": 72 | Glide.with(this).load(images[4]).into(new GlideDrawableImageViewTarget((ImageView) findViewById(R.id.gif))); 73 | break; 74 | case "Selection Sort": 75 | Glide.with(this).load(images[5]).into(new GlideDrawableImageViewTarget((ImageView) findViewById(R.id.gif))); 76 | break; 77 | } 78 | Bundle bundle=new Bundle(); 79 | bundle.putString(Description.DESC,title); 80 | Description description=new Description(); 81 | description.setArguments(bundle); 82 | getSupportFragmentManager().beginTransaction().commit(); 83 | tab.addTab(tab.newTab().setText("Description")); 84 | tab.addTab(tab.newTab().setText("C++ Program")); 85 | tab.addTab(tab.newTab().setText("Algorithm")); 86 | tabPagerAdapter=new TabPagerAdapter(getSupportFragmentManager()); 87 | mPager.setAdapter(tabPagerAdapter); 88 | mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tab)); 89 | tab.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { 90 | @Override 91 | public void onTabSelected(TabLayout.Tab tab) { 92 | mPager.setCurrentItem(tab.getPosition()); 93 | } 94 | 95 | @Override 96 | public void onTabUnselected(TabLayout.Tab tab) { 97 | 98 | } 99 | 100 | @Override 101 | public void onTabReselected(TabLayout.Tab tab) { 102 | 103 | } 104 | }); 105 | } 106 | 107 | @Override 108 | public boolean onOptionsItemSelected(MenuItem item) { 109 | int id = item.getItemId(); 110 | if (id == android.R.id.home) { 111 | finish(); 112 | return true; 113 | } 114 | return super.onOptionsItemSelected(item); 115 | } 116 | 117 | public static String gettitle() { 118 | return title; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/adapters/CustomListDynamicAdapter.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.adapters; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import com.developers.algoexplorer.R; 12 | 13 | import java.util.ArrayList; 14 | 15 | /** 16 | * Created by Amanjeet Singh on 17-Jan-17. 17 | */ 18 | 19 | public class CustomListDynamicAdapter extends BaseAdapter { 20 | Context context; 21 | ArrayList dynamicpro; 22 | 23 | public CustomListDynamicAdapter(Context context,ArrayList dynamicpro){ 24 | this.context=context; 25 | this.dynamicpro=dynamicpro; 26 | } 27 | 28 | @Override 29 | public int getCount() { 30 | return dynamicpro.size(); 31 | } 32 | 33 | @Override 34 | public Object getItem(int i) { 35 | return dynamicpro.get(i); 36 | } 37 | 38 | @Override 39 | public long getItemId(int i) { 40 | return i; 41 | } 42 | 43 | @Override 44 | public View getView(int i, View view, ViewGroup viewGroup) { 45 | LayoutInflater mInflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 46 | view=mInflater.inflate(R.layout.list_dynamic_row,null); 47 | ImageView img= (ImageView) view.findViewById(R.id.dynamicimg); 48 | TextView dynamicname=(TextView)view.findViewById(R.id.dynamic); 49 | String d=dynamicpro.get(i); 50 | switch (d){ 51 | case "0-1 Knapsack": 52 | img.setImageResource(R.drawable.knapsack_list); 53 | dynamicname.setText("0-1 Knapsack"); 54 | break; 55 | case "Binomial Coefficient": 56 | img.setImageResource(R.drawable.binomial_list); 57 | dynamicname.setText("Binomial Coefficient"); 58 | break; 59 | case "Longest Common Subsequence": 60 | img.setImageResource(R.drawable.longest_list); 61 | dynamicname.setText("Longest Common Subsequence"); 62 | break; 63 | case "Matrix Chain Multiplication": 64 | img.setImageResource(R.drawable.mcm_list); 65 | dynamicname.setText("Matrix Chain Multiplication"); 66 | break; 67 | } 68 | return view; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/adapters/CustomListGraphAdapter.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.adapters; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import com.bumptech.glide.Glide; 12 | import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; 13 | import com.developers.algoexplorer.R; 14 | 15 | import java.util.ArrayList; 16 | 17 | /** 18 | * Created by Amanjeet Singh on 23-Jan-17. 19 | */ 20 | 21 | public class CustomListGraphAdapter extends BaseAdapter { 22 | 23 | private Context context; 24 | private ArrayList graphlist; 25 | 26 | public CustomListGraphAdapter(Context context, ArrayList graphlist){ 27 | this.context=context; 28 | this.graphlist=graphlist; 29 | } 30 | 31 | @Override 32 | public int getCount() { 33 | return graphlist.size(); 34 | } 35 | 36 | @Override 37 | public Object getItem(int i) { 38 | return graphlist.get(i); 39 | } 40 | 41 | @Override 42 | public long getItemId(int i) { 43 | return i; 44 | } 45 | 46 | @Override 47 | public View getView(int i, View view, ViewGroup viewGroup) { 48 | LayoutInflater inflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 49 | view=inflater.inflate(R.layout.list_graph_row,null); 50 | ImageView img= (ImageView) view.findViewById(R.id.graphimg); 51 | TextView graphname=(TextView)view.findViewById(R.id.graph); 52 | String gr=graphlist.get(i); 53 | switch(gr){ 54 | case "Floyd–Warshall algorithm": 55 | img.setImageResource(R.drawable.floyd_list); 56 | graphname.setText("Floyd–Warshall algorithm"); 57 | break; 58 | case "Dijkstra's algorithm": 59 | Glide.with(context).load(R.drawable.dijkstra_list).into(new GlideDrawableImageViewTarget(img)); 60 | graphname.setText("Dijkstra's algorithm"); 61 | break; 62 | } 63 | return view; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/adapters/CustomListSearchingAdapter.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.adapters; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import com.developers.algoexplorer.R; 12 | 13 | import java.util.ArrayList; 14 | 15 | /** 16 | * Created by Amanjeet Singh on 16-Jan-17. 17 | */ 18 | 19 | public class CustomListSearchingAdapter extends BaseAdapter { 20 | Context context; 21 | ArrayList mlist; 22 | public CustomListSearchingAdapter(Context context,ArrayList mlist){ 23 | this.context=context; 24 | this.mlist=mlist; 25 | } 26 | 27 | @Override 28 | public int getCount() { 29 | return mlist.size(); 30 | } 31 | 32 | @Override 33 | public Object getItem(int i) { 34 | return mlist.get(i); 35 | } 36 | 37 | @Override 38 | public long getItemId(int i) { 39 | return i; 40 | } 41 | 42 | @Override 43 | public View getView(int i, View view, ViewGroup viewGroup) { 44 | LayoutInflater layoutInflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 45 | view=layoutInflater.inflate(R.layout.list_search_row,null); 46 | ImageView img= (ImageView) view.findViewById(R.id.searchimg); 47 | TextView searchname=(TextView)view.findViewById(R.id.search); 48 | String se=mlist.get(i); 49 | switch(se){ 50 | case "Linear Search": 51 | img.setImageResource(R.drawable.linearsearch_list); 52 | searchname.setText("Linear Search"); 53 | break; 54 | case "Binary Search": 55 | img.setImageResource(R.drawable.binarysearch_list); 56 | searchname.setText("Binary Search"); 57 | break; 58 | } 59 | return view; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/adapters/CustomListSortingAdapter.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.adapters; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import com.developers.algoexplorer.R; 12 | 13 | import java.util.ArrayList; 14 | 15 | /** 16 | * Created by Amanjeet Singh on 08-Jan-17. 17 | */ 18 | public class CustomListSortingAdapter extends BaseAdapter { 19 | Context context; 20 | ArrayList arrayList; 21 | 22 | public CustomListSortingAdapter(Context context, ArrayList arrayList){ 23 | this.context=context; 24 | this.arrayList=arrayList; 25 | } 26 | 27 | @Override 28 | public int getCount() { 29 | return arrayList.size(); 30 | } 31 | 32 | @Override 33 | public Object getItem(int position) { 34 | return arrayList.get(position); 35 | } 36 | 37 | @Override 38 | public long getItemId(int position) { 39 | return position; 40 | } 41 | 42 | @Override 43 | public View getView(int position, View convertView, ViewGroup parent) { 44 | LayoutInflater mInflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 45 | convertView=mInflater.inflate(R.layout.list_sort_row,null); 46 | TextView s=(TextView)convertView.findViewById(R.id.sort); 47 | ImageView sortimg=(ImageView)convertView.findViewById(R.id.sortimage); 48 | String name=arrayList.get(position); 49 | switch (name){ 50 | case "Bubble Sort": 51 | sortimg.setImageResource(R.drawable.bubblesort_list); 52 | s.setText("Bubble Sort"); 53 | break; 54 | case "Merge Sort": 55 | sortimg.setImageResource(R.drawable.mergesort_list); 56 | s.setText("Merge Sort"); 57 | break; 58 | case "Insertion Sort": 59 | sortimg.setImageResource(R.drawable.insertionsort_list); 60 | s.setText("Insertion Sort"); 61 | break; 62 | case "Heap Sort": 63 | sortimg.setImageResource(R.drawable.heapsort_list); 64 | s.setText("Heap Sort"); 65 | break; 66 | case "Selection Sort": 67 | sortimg.setImageResource(R.drawable.selectionsort_list); 68 | s.setText("Selection Sort"); 69 | break; 70 | case "Quick Sort": 71 | sortimg.setImageResource(R.drawable.quicksort_list); 72 | s.setText("Quick Sort"); 73 | } 74 | return convertView; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/adapters/DynamicTabPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.adapters; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import com.developers.algoexplorer.fragments.DynamicAlgorithms; 8 | import com.developers.algoexplorer.fragments.DynamicDescription; 9 | import com.developers.algoexplorer.fragments.DynamicExample; 10 | import com.developers.algoexplorer.fragments.DynamicPrograms; 11 | 12 | /** 13 | * Created by Amanjeet Singh on 19-Jan-17. 14 | */ 15 | 16 | public class DynamicTabPagerAdapter extends FragmentPagerAdapter { 17 | 18 | public DynamicTabPagerAdapter(FragmentManager fm) { 19 | super(fm); 20 | } 21 | 22 | @Override 23 | public Fragment getItem(int position) { 24 | switch(position){ 25 | case 0: 26 | return new DynamicDescription(); 27 | case 1: 28 | return new DynamicPrograms(); 29 | case 2: 30 | return new DynamicAlgorithms(); 31 | case 3: 32 | return new DynamicExample(); 33 | } 34 | return null; 35 | } 36 | @Override 37 | public int getCount() { 38 | return 4; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/adapters/GraphTabPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.adapters; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import com.developers.algoexplorer.fragments.GraphAlgorithms; 8 | import com.developers.algoexplorer.fragments.GraphDescription; 9 | import com.developers.algoexplorer.fragments.GraphPrograms; 10 | 11 | /** 12 | * Created by Amanjeet Singh on 23-Jan-17. 13 | */ 14 | 15 | public class GraphTabPagerAdapter extends FragmentPagerAdapter { 16 | 17 | public GraphTabPagerAdapter(FragmentManager fm) { 18 | super(fm); 19 | } 20 | 21 | @Override 22 | public Fragment getItem(int position) { 23 | switch(position){ 24 | case 0: 25 | return new GraphDescription(); 26 | case 1: 27 | return new GraphPrograms(); 28 | case 2: 29 | return new GraphAlgorithms(); 30 | } 31 | return null; 32 | } 33 | 34 | @Override 35 | public int getCount() { 36 | return 3; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/adapters/SearchTabPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.adapters; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import com.developers.algoexplorer.fragments.SearchDescription; 8 | import com.developers.algoexplorer.fragments.SearchPrograms; 9 | import com.developers.algoexplorer.fragments.SearchingAlgorithms; 10 | 11 | /** 12 | * Created by Amanjeet Singh on 16-Jan-17. 13 | */ 14 | 15 | public class SearchTabPagerAdapter extends FragmentPagerAdapter { 16 | 17 | public SearchTabPagerAdapter(FragmentManager fm) { 18 | super(fm); 19 | } 20 | 21 | @Override 22 | public Fragment getItem(int position) { 23 | switch (position){ 24 | case 0: 25 | return new SearchDescription(); 26 | case 1: 27 | return new SearchPrograms(); 28 | case 2: 29 | return new SearchingAlgorithms(); 30 | } 31 | return null; 32 | } 33 | 34 | @Override 35 | public int getCount() { 36 | return 3; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/adapters/TabPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.adapters; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import com.developers.algoexplorer.fragments.Algorithm; 8 | import com.developers.algoexplorer.fragments.Description; 9 | import com.developers.algoexplorer.fragments.Program; 10 | 11 | /** 12 | * Created by Amanjeet Singh on 12-Jan-17. 13 | */ 14 | 15 | public class TabPagerAdapter extends FragmentPagerAdapter { 16 | 17 | public TabPagerAdapter(FragmentManager fm) { 18 | super(fm); 19 | } 20 | 21 | @Override 22 | public Fragment getItem(int position) { 23 | switch(position){ 24 | case 0: 25 | return new Description(); 26 | case 1: 27 | return new Program(); 28 | case 2: 29 | return new Algorithm(); 30 | } 31 | return null; 32 | } 33 | 34 | @Override 35 | public int getCount() { 36 | return 3; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/Algorithm.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import com.developers.algoexplorer.Algorithms.SortingAlgorithms; 13 | import com.developers.algoexplorer.Programs.SortingPrograms; 14 | import com.developers.algoexplorer.R; 15 | import com.developers.algoexplorer.SortingActivity; 16 | 17 | import thereisnospon.codeview.CodeView; 18 | import thereisnospon.codeview.CodeViewTheme; 19 | 20 | /** 21 | * A simple {@link Fragment} subclass. 22 | */ 23 | public class Algorithm extends Fragment { 24 | private CodeView algoview; 25 | private SortingActivity sortingActivity; 26 | private String titlealgo; 27 | public Algorithm() { 28 | // Required empty public constructor 29 | } 30 | 31 | 32 | @Override 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 | Bundle savedInstanceState) { 35 | // Inflate the layout for this fragment 36 | View v1= inflater.inflate(R.layout.fragment_algorithm, container, false); 37 | algoview= (CodeView) v1.findViewById(R.id.algorithm); 38 | switch(titlealgo){ 39 | case "Bubble Sort":addAlgo(SortingAlgorithms.BUBBLE_SORT_ALGO); 40 | break; 41 | case "Merge Sort":addAlgo(SortingAlgorithms.MERGE_SORT_ALGO); 42 | break; 43 | case "Insertion Sort":addAlgo(SortingAlgorithms.INSERTION_SORT_ALGORITHM); 44 | break; 45 | case "Quick Sort":addAlgo(SortingAlgorithms.QUICK_SORT_ALGORITHM); 46 | break; 47 | case "Heap Sort":addAlgo(SortingAlgorithms.HEAP_SORT_ALGORITHM); 48 | break; 49 | case "Selection Sort":addAlgo(SortingAlgorithms.SELECTION_SORT_ALGORITHM); 50 | break; 51 | } 52 | return v1; 53 | } 54 | 55 | private void addAlgo(String algoCode) { 56 | algoview.setTheme(CodeViewTheme.GITHUB); 57 | algoview.setHorizontalScrollBarEnabled(true); 58 | algoview.setVerticalScrollBarEnabled(true); 59 | algoview.setOnTouchListener(new View.OnTouchListener() { 60 | @Override 61 | public boolean onTouch(View view, MotionEvent motionEvent) { 62 | //view.getParent().requestDisallowInterceptTouchEvent(true); 63 | return false; 64 | } 65 | }); 66 | algoview.showCode(algoCode); 67 | } 68 | 69 | @Override 70 | public void onAttach(Context context) { 71 | super.onAttach(context); 72 | try{ 73 | sortingActivity= (SortingActivity) context; 74 | titlealgo=sortingActivity.gettitle(); 75 | } 76 | catch (Exception e){ 77 | e.printStackTrace(); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/Dynamic.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.AdapterView; 11 | import android.widget.ListView; 12 | 13 | import com.developers.algoexplorer.DynamicActivity; 14 | import com.developers.algoexplorer.R; 15 | import com.developers.algoexplorer.adapters.CustomListDynamicAdapter; 16 | 17 | import java.util.ArrayList; 18 | 19 | /** 20 | * A simple {@link Fragment} subclass. 21 | */ 22 | public class Dynamic extends Fragment { 23 | 24 | private ArrayList dynamicname=new ArrayList<>(); 25 | private ListView dynamicnamelist; 26 | private CustomListDynamicAdapter dynamicAdapter; 27 | private Intent intent; 28 | public Dynamic() { 29 | // Required empty public constructor 30 | } 31 | 32 | 33 | @Override 34 | public View onCreateView(final LayoutInflater inflater, ViewGroup container, 35 | Bundle savedInstanceState) { 36 | // Inflate the layout for this fragment 37 | View v= inflater.inflate(R.layout.fragment_dynamic, container, false); 38 | dynamicnamelist= (ListView) v.findViewById(R.id.list3); 39 | dynamicname.add(0,"0-1 Knapsack"); 40 | dynamicname.add(1,"Binomial Coefficient"); 41 | dynamicname.add(2,"Longest Common Subsequence"); 42 | dynamicname.add(3,"Matrix Chain Multiplication"); 43 | dynamicAdapter=new CustomListDynamicAdapter(getActivity(),dynamicname); 44 | dynamicnamelist.setAdapter(dynamicAdapter); 45 | dynamicnamelist.setOnItemClickListener(new AdapterView.OnItemClickListener() { 46 | @Override 47 | public void onItemClick(AdapterView adapterView, View view, int i, long l) { 48 | intent=new Intent(getActivity(), DynamicActivity.class); 49 | intent.putExtra("dynamicname",dynamicname.get(i)); 50 | startActivity(intent); 51 | } 52 | }); 53 | return v; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/DynamicAlgorithms.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import com.developers.algoexplorer.Algorithms.DynamicProgrammingAlgos; 13 | import com.developers.algoexplorer.DynamicActivity; 14 | import com.developers.algoexplorer.R; 15 | 16 | import thereisnospon.codeview.CodeView; 17 | import thereisnospon.codeview.CodeViewTheme; 18 | 19 | /** 20 | * A simple {@link Fragment} subclass. 21 | */ 22 | public class DynamicAlgorithms extends Fragment { 23 | 24 | private CodeView dynamicalgo; 25 | private String title; 26 | private DynamicActivity dynamicActivity; 27 | public DynamicAlgorithms() { 28 | // Required empty public constructor 29 | } 30 | 31 | 32 | @Override 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 | Bundle savedInstanceState) { 35 | // Inflate the layout for this fragment 36 | View v2= inflater.inflate(R.layout.fragment_dynamic_algorithms, container, false); 37 | dynamicalgo= (CodeView) v2.findViewById(R.id.dynamicalgorithm); 38 | switch (title){ 39 | case "0-1 Knapsack": 40 | addAlgo(DynamicProgrammingAlgos.knapsackalgo); 41 | break; 42 | case "Binomial Coefficient": 43 | addAlgo(DynamicProgrammingAlgos.binomialalgo); 44 | break; 45 | case "Longest Common Subsequence": 46 | addAlgo(DynamicProgrammingAlgos.lcsalgo); 47 | break; 48 | case "Matrix Chain Multiplication": 49 | addAlgo(DynamicProgrammingAlgos.mcmalgo); 50 | break; 51 | } 52 | return v2; 53 | } 54 | 55 | private void addAlgo(String algo) { 56 | dynamicalgo.setTheme(CodeViewTheme.GITHUB); 57 | dynamicalgo.setHorizontalScrollBarEnabled(true); 58 | dynamicalgo.setVerticalScrollBarEnabled(true); 59 | dynamicalgo.setOnTouchListener(new View.OnTouchListener() { 60 | @Override 61 | public boolean onTouch(View view, MotionEvent motionEvent) { 62 | //view.getParent().requestDisallowInterceptTouchEvent(true); 63 | return false; 64 | } 65 | }); 66 | dynamicalgo.showCode(algo); 67 | } 68 | 69 | @Override 70 | public void onAttach(Context context) { 71 | super.onAttach(context); 72 | try { 73 | dynamicActivity = (DynamicActivity) context; 74 | title=dynamicActivity.getDynamicTitle(); 75 | } 76 | catch (Exception e){ 77 | e.printStackTrace(); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/DynamicDescription.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.TextView; 11 | 12 | import com.developers.algoexplorer.DynamicActivity; 13 | import com.developers.algoexplorer.R; 14 | 15 | import java.util.ArrayList; 16 | 17 | /** 18 | * A simple {@link Fragment} subclass. 19 | */ 20 | public class DynamicDescription extends Fragment { 21 | 22 | private TextView dynamicdescription,formula,complexity; 23 | private DynamicActivity dynamicActivity; 24 | private String dynamicname,des,form; 25 | private ArrayList complexities=new ArrayList<>(); 26 | public DynamicDescription() { 27 | // Required empty public constructor 28 | } 29 | 30 | 31 | @Override 32 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 33 | Bundle savedInstanceState) { 34 | // Inflate the layout for this fragment 35 | View v= inflater.inflate(R.layout.fragment_dynamic_description, container, false); 36 | dynamicdescription= (TextView) v.findViewById(R.id.dynamicdesc); 37 | formula=(TextView)v.findViewById(R.id.formula); 38 | complexity= (TextView) v.findViewById(R.id.comp); 39 | complexities.add(0,"O(nW)"); 40 | complexities.add(1,"O(n*k)"); 41 | complexities.add(2,"O(mn)"); 42 | complexities.add(3,"O(N^3)"); 43 | switch(dynamicname){ 44 | case "0-1 Knapsack": 45 | des=getResources().getString(R.string.knapsack_desc); 46 | dynamicdescription.setText(des); 47 | form=getResources().getString(R.string.knapsack_formula); 48 | formula.setText(form); 49 | complexity.setText(complexities.get(0)+"\nwhere n is the number of items and W is the capacity of knapsack."); 50 | break; 51 | case "Binomial Coefficient": 52 | des=getResources().getString(R.string.binomial_desc); 53 | dynamicdescription.setText(des); 54 | form=getResources().getString(R.string.binomial_formula); 55 | formula.setText(form); 56 | complexity.setText(complexities.get(1)); 57 | break; 58 | case "Longest Common Subsequence": 59 | des=getResources().getString(R.string.lcs_desc); 60 | dynamicdescription.setText(des); 61 | form=getResources().getString(R.string.lcs_formula); 62 | formula.setText(form); 63 | complexity.setText(complexities.get(2)+"for finding LCS length"); 64 | break; 65 | case "Matrix Chain Multiplication": 66 | des=getResources().getString(R.string.mcm_desc); 67 | dynamicdescription.setText(des); 68 | form=getResources().getString(R.string.mcm_formula); 69 | formula.setText(form); 70 | complexity.setText(complexities.get(3)); 71 | break; 72 | } 73 | 74 | return v; 75 | } 76 | 77 | @Override 78 | public void onAttach(Context context) { 79 | super.onAttach(context); 80 | try { 81 | dynamicActivity = (DynamicActivity) context; 82 | dynamicname = dynamicActivity.getDynamicTitle(); 83 | } 84 | catch (Exception e){ 85 | e.printStackTrace(); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/DynamicExample.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Context; 5 | import android.content.res.AssetManager; 6 | import android.os.Bundle; 7 | import android.support.v4.app.Fragment; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | import com.developers.algoexplorer.DynamicActivity; 14 | import com.developers.algoexplorer.R; 15 | 16 | import java.io.BufferedInputStream; 17 | import java.io.BufferedReader; 18 | import java.io.IOException; 19 | import java.io.InputStream; 20 | import java.io.InputStreamReader; 21 | 22 | /** 23 | * A simple {@link Fragment} subclass. 24 | */ 25 | public class DynamicExample extends Fragment { 26 | 27 | 28 | 29 | private AssetManager as; 30 | private InputStream is; 31 | private TextView exp; 32 | private DynamicActivity activity; 33 | private String methodname; 34 | public DynamicExample() { 35 | // Required empty public constructor 36 | } 37 | 38 | 39 | @Override 40 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 41 | Bundle savedInstanceState) { 42 | // Inflate the layout for this fragment 43 | View v2= inflater.inflate(R.layout.fragment_dynamic_example, container, false); 44 | exp= (TextView) v2.findViewById(R.id.exp); 45 | as=getActivity().getAssets(); 46 | try { 47 | switch(methodname){ 48 | case "0-1 Knapsack": 49 | is=as.open("knapsackexp.txt"); 50 | break; 51 | case "Binomial Coefficient": 52 | is=as.open("binomialexp.txt"); 53 | break; 54 | case "Longest Common Subsequence": 55 | is=as.open("lcsexp.txt"); 56 | break; 57 | case "Matrix Chain Multiplication": 58 | is=as.open("mcmexp.txt"); 59 | break; 60 | 61 | } 62 | BufferedReader bis=new BufferedReader(new InputStreamReader(is)); 63 | StringBuffer buffer=new StringBuffer(); 64 | String line=""; 65 | while((line=bis.readLine())!=null){ 66 | buffer.append(line+"\n"); 67 | } 68 | String txt=buffer.toString(); 69 | exp.setText(txt); 70 | } catch (Exception e) { 71 | e.printStackTrace(); 72 | } 73 | return v2; 74 | } 75 | 76 | @Override 77 | public void onAttach(Context context) { 78 | super.onAttach(context); 79 | activity= (DynamicActivity) context; 80 | methodname=activity.getDynamicTitle(); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/DynamicPrograms.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import com.developers.algoexplorer.DynamicActivity; 13 | import com.developers.algoexplorer.Programs.DynamicProgrammingProg; 14 | import com.developers.algoexplorer.R; 15 | 16 | import thereisnospon.codeview.CodeView; 17 | import thereisnospon.codeview.CodeViewTheme; 18 | 19 | /** 20 | * A simple {@link Fragment} subclass. 21 | */ 22 | public class DynamicPrograms extends Fragment { 23 | 24 | private CodeView dynamicpro; 25 | private DynamicActivity dynamicActivity; 26 | private String names; 27 | public DynamicPrograms() { 28 | // Required empty public constructor 29 | } 30 | 31 | 32 | @Override 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 | Bundle savedInstanceState) { 35 | // Inflate the layout for this fragment 36 | View v= inflater.inflate(R.layout.fragment_dynamic_programs, container, false); 37 | dynamicpro= (CodeView) v.findViewById(R.id.program2); 38 | switch (names){ 39 | case "0-1 Knapsack": 40 | addPro(DynamicProgrammingProg.Knapsack); 41 | break; 42 | case "Binomial Coefficient": 43 | addPro(DynamicProgrammingProg.binomial); 44 | break; 45 | case "Longest Common Subsequence": 46 | addPro(DynamicProgrammingProg.LcsProg); 47 | break; 48 | case "Matrix Chain Multiplication": 49 | addPro(DynamicProgrammingProg.MCM_prog); 50 | break; 51 | } 52 | return v; 53 | } 54 | 55 | private void addPro(String source) { 56 | dynamicpro.setTheme(CodeViewTheme.GITHUB); 57 | dynamicpro.setHorizontalScrollBarEnabled(true); 58 | dynamicpro.setVerticalScrollBarEnabled(true); 59 | dynamicpro.setOnTouchListener(new View.OnTouchListener() { 60 | @Override 61 | public boolean onTouch(View view, MotionEvent motionEvent) { 62 | //view.getParent().requestDisallowInterceptTouchEvent(true); 63 | return false; 64 | } 65 | }); 66 | dynamicpro.showCode(source); 67 | } 68 | 69 | @Override 70 | public void onAttach(Context context) { 71 | super.onAttach(context); 72 | try{ 73 | dynamicActivity= (DynamicActivity) context; 74 | names=dynamicActivity.getDynamicTitle(); 75 | } 76 | catch (Exception e){ 77 | e.printStackTrace(); 78 | } 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/GraphAlgorithms.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import com.developers.algoexplorer.Algorithms.GraphAlgos; 13 | import com.developers.algoexplorer.GraphActivity; 14 | import com.developers.algoexplorer.R; 15 | 16 | import thereisnospon.codeview.CodeView; 17 | import thereisnospon.codeview.CodeViewTheme; 18 | 19 | /** 20 | * A simple {@link Fragment} subclass. 21 | */ 22 | public class GraphAlgorithms extends Fragment { 23 | 24 | 25 | public GraphAlgorithms() { 26 | // Required empty public constructor 27 | } 28 | 29 | private CodeView algoview; 30 | private GraphActivity graphActivity; 31 | private String graphname; 32 | @Override 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 | Bundle savedInstanceState) { 35 | // Inflate the layout for this fragment 36 | View v= inflater.inflate(R.layout.fragment_graph_algorithms, container, false); 37 | algoview= (CodeView) v.findViewById(R.id.graphalgorithm); 38 | switch (graphname){ 39 | case "Floyd–Warshall algorithm": 40 | addAlgo(GraphAlgos.floydalgo); 41 | break; 42 | case "Dijkstra's algorithm": 43 | addAlgo(GraphAlgos.dijalgo); 44 | break; 45 | } 46 | return v; 47 | 48 | } 49 | 50 | private void addAlgo(String algo) { 51 | 52 | algoview.setTheme(CodeViewTheme.GITHUB); 53 | algoview.setHorizontalScrollBarEnabled(true); 54 | algoview.setVerticalScrollBarEnabled(true); 55 | algoview.setOnTouchListener(new View.OnTouchListener() { 56 | @Override 57 | public boolean onTouch(View view, MotionEvent motionEvent) { 58 | //view.getParent().requestDisallowInterceptTouchEvent(true); 59 | return false; 60 | } 61 | }); 62 | algoview.showCode(algo); 63 | } 64 | 65 | @Override 66 | public void onAttach(Context context) { 67 | super.onAttach(context); 68 | try{ 69 | graphActivity= (GraphActivity) context; 70 | graphname=graphActivity.getGraphtitle(); 71 | } 72 | catch (Exception e){ 73 | e.printStackTrace(); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/GraphDescription.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.TextView; 11 | 12 | import com.developers.algoexplorer.GraphActivity; 13 | import com.developers.algoexplorer.R; 14 | 15 | import java.util.ArrayList; 16 | 17 | /** 18 | * A simple {@link Fragment} subclass. 19 | */ 20 | public class GraphDescription extends Fragment { 21 | 22 | 23 | public GraphDescription() { 24 | // Required empty public constructor 25 | } 26 | 27 | private TextView graphdescription,graphcomplexity,graphspacecomplexity; 28 | private GraphActivity graphActivity; 29 | private ArrayList complexities=new ArrayList(); 30 | private ArrayList spacecomplexities=new ArrayList<>(); 31 | private String graphtitle; 32 | @Override 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 | Bundle savedInstanceState) { 35 | // Inflate the layout for this fragment 36 | View v= inflater.inflate(R.layout.fragment_graph_description, container, false); 37 | graphdescription= (TextView) v.findViewById(R.id.graphdesc); 38 | graphcomplexity= (TextView) v.findViewById(R.id.graphcomp); 39 | graphspacecomplexity= (TextView) v.findViewById(R.id.graphcomp2); 40 | complexities.add(0,"O(|V|^3) where V is number of vertices"); 41 | complexities.add(1,"O(|V|^2) where V is number of vertices"); 42 | spacecomplexities.add(0,"O(|V|^2)"); 43 | spacecomplexities.add(1,"O(|V|)"); 44 | switch (graphtitle){ 45 | case "Floyd–Warshall algorithm": 46 | String des=getResources().getString(R.string.floyd_desc); 47 | graphdescription.setText(des); 48 | graphcomplexity.setText(complexities.get(0)); 49 | graphspacecomplexity.setText(spacecomplexities.get(0)); 50 | break; 51 | case "Dijkstra's algorithm": 52 | String des1=getResources().getString(R.string.dij_desc); 53 | graphdescription.setText(des1); 54 | graphcomplexity.setText(complexities.get(1)); 55 | graphspacecomplexity.setText(spacecomplexities.get(1)); 56 | break; 57 | } 58 | return v; 59 | } 60 | 61 | @Override 62 | public void onAttach(Context context) { 63 | super.onAttach(context); 64 | try{ 65 | graphActivity= (GraphActivity) context; 66 | graphtitle=graphActivity.getGraphtitle(); 67 | } 68 | catch (Exception e){ 69 | e.printStackTrace(); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/GraphPrograms.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import com.developers.algoexplorer.DynamicActivity; 13 | import com.developers.algoexplorer.GraphActivity; 14 | import com.developers.algoexplorer.Programs.GraphProgramming; 15 | import com.developers.algoexplorer.R; 16 | 17 | import thereisnospon.codeview.CodeView; 18 | import thereisnospon.codeview.CodeViewTheme; 19 | 20 | /** 21 | * A simple {@link Fragment} subclass. 22 | */ 23 | public class GraphPrograms extends Fragment { 24 | 25 | 26 | public GraphPrograms() { 27 | // Required empty public constructor 28 | } 29 | 30 | private CodeView graphpro; 31 | private GraphActivity graphActivity; 32 | private String names; 33 | @Override 34 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 35 | Bundle savedInstanceState) { 36 | // Inflate the layout for this fragment 37 | View v1=inflater.inflate(R.layout.fragment_graph_programs, container, false); 38 | graphpro= (CodeView) v1.findViewById(R.id.graphprogram); 39 | switch (names){ 40 | case "Floyd–Warshall algorithm": 41 | addPro(GraphProgramming.floydpro); 42 | break; 43 | case "Dijkstra's algorithm": 44 | addPro(GraphProgramming.dijpro); 45 | break; 46 | } 47 | return v1; 48 | } 49 | @Override 50 | public void onAttach(Context context) { 51 | super.onAttach(context); 52 | try{ 53 | graphActivity= (GraphActivity) context; 54 | names=graphActivity.getGraphtitle(); 55 | } 56 | catch (Exception e){ 57 | e.printStackTrace(); 58 | } 59 | 60 | } 61 | 62 | private void addPro(String source) { 63 | graphpro.setTheme(CodeViewTheme.GITHUB); 64 | graphpro.setHorizontalScrollBarEnabled(true); 65 | graphpro.setVerticalScrollBarEnabled(true); 66 | graphpro.setOnTouchListener(new View.OnTouchListener() { 67 | @Override 68 | public boolean onTouch(View view, MotionEvent motionEvent) { 69 | //view.getParent().requestDisallowInterceptTouchEvent(true); 70 | return false; 71 | } 72 | }); 73 | graphpro.showCode(source); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/Graphs.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.AdapterView; 11 | import android.widget.ListView; 12 | 13 | import com.developers.algoexplorer.GraphActivity; 14 | import com.developers.algoexplorer.R; 15 | import com.developers.algoexplorer.adapters.CustomListGraphAdapter; 16 | 17 | import java.util.ArrayList; 18 | 19 | /** 20 | * A simple {@link Fragment} subclass. 21 | */ 22 | public class Graphs extends Fragment { 23 | 24 | 25 | public Graphs() { 26 | // Required empty public constructor 27 | } 28 | 29 | private ListView graphlist; 30 | private ArrayList graphalgo=new ArrayList(); 31 | private CustomListGraphAdapter adapter; 32 | @Override 33 | public View onCreateView(final LayoutInflater inflater, ViewGroup container, 34 | Bundle savedInstanceState) { 35 | // Inflate the layout for this fragment 36 | View v= inflater.inflate(R.layout.fragment_graphs, container, false); 37 | graphlist= (ListView) v.findViewById(R.id.list4); 38 | graphalgo.add(0,"Floyd–Warshall algorithm"); 39 | graphalgo.add(1,"Dijkstra's algorithm"); 40 | adapter=new CustomListGraphAdapter(getActivity(),graphalgo); 41 | graphlist.setAdapter(adapter); 42 | graphlist.setOnItemClickListener(new AdapterView.OnItemClickListener() { 43 | @Override 44 | public void onItemClick(AdapterView adapterView, View view, int i, long l) { 45 | Intent intent=new Intent(getActivity(), GraphActivity.class); 46 | intent.putExtra("graphname",graphalgo.get(i)); 47 | startActivity(intent); 48 | } 49 | }); 50 | return v; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/Program.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import com.developers.algoexplorer.Programs.SortingPrograms; 13 | import com.developers.algoexplorer.R; 14 | import com.developers.algoexplorer.SortingActivity; 15 | 16 | import thereisnospon.codeview.CodeView; 17 | import thereisnospon.codeview.CodeViewTheme; 18 | 19 | /** 20 | * A simple {@link Fragment} subclass. 21 | */ 22 | public class Program extends Fragment { 23 | 24 | private SortingActivity sort; 25 | private String title1; 26 | private CodeView program; 27 | public Program() { 28 | // Required empty public constructor 29 | } 30 | 31 | 32 | @Override 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 | Bundle savedInstanceState) { 35 | // Inflate the layout for this fragment 36 | View v2= inflater.inflate(R.layout.fragment_program, container, false); 37 | program= (CodeView) v2.findViewById(R.id.program); 38 | switch(title1){ 39 | case "Bubble Sort":addCode(SortingPrograms.BUBBLE_SORT_PROG); 40 | break; 41 | case "Merge Sort":addCode(SortingPrograms.MERGE_SORT_PROGRAM); 42 | break; 43 | case "Insertion Sort":addCode(SortingPrograms.INSERTION_SORT_PROGRAM); 44 | break; 45 | case "Quick Sort":addCode(SortingPrograms.QUICK_SORT_PROGRAM); 46 | break; 47 | case "Heap Sort":addCode(SortingPrograms.HEAP_SORT_PROGRAM); 48 | break; 49 | case "Selection Sort":addCode(SortingPrograms.SELECTION_SORT_PROGRAM); 50 | break; 51 | } 52 | return v2; 53 | } 54 | 55 | @Override 56 | public void onAttach(Context context) { 57 | super.onAttach(context); 58 | try { 59 | sort = (SortingActivity) context; 60 | title1 = sort.gettitle(); 61 | } 62 | catch (Exception e){ 63 | e.printStackTrace(); 64 | } 65 | } 66 | private void addCode(String source){ 67 | program.setTheme(CodeViewTheme.GITHUB); 68 | program.setHorizontalScrollBarEnabled(true); 69 | program.setVerticalScrollBarEnabled(true); 70 | program.setOnTouchListener(new View.OnTouchListener() { 71 | @Override 72 | public boolean onTouch(View view, MotionEvent motionEvent) { 73 | //view.getParent().requestDisallowInterceptTouchEvent(true); 74 | return false; 75 | } 76 | }); 77 | program.showCode(source); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/SearchDescription.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.app.ProgressDialog; 5 | import android.content.Context; 6 | import android.net.ConnectivityManager; 7 | import android.net.NetworkInfo; 8 | import android.os.Bundle; 9 | import android.support.v4.app.Fragment; 10 | import android.util.Log; 11 | import android.view.LayoutInflater; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | import android.widget.TextView; 15 | import android.widget.Toast; 16 | 17 | import com.developers.algoexplorer.R; 18 | import com.developers.algoexplorer.SearchingActivity; 19 | import com.google.firebase.database.DataSnapshot; 20 | import com.google.firebase.database.DatabaseError; 21 | import com.google.firebase.database.DatabaseReference; 22 | import com.google.firebase.database.FirebaseDatabase; 23 | import com.google.firebase.database.ValueEventListener; 24 | 25 | import java.util.ArrayList; 26 | 27 | /** 28 | * A simple {@link Fragment} subclass. 29 | */ 30 | public class SearchDescription extends Fragment { 31 | 32 | private TextView searchdescription,bestcase,worstcase,averagecase,space; 33 | private DatabaseReference reference; 34 | private SearchingActivity searchingActivity; 35 | private String searchtitle,searchinfo; 36 | private ArrayList searchinfoList=new ArrayList(); 37 | private ArrayList bestcasecomplexities=new ArrayList(); 38 | private ArrayList worstcasecomplexities=new ArrayList(); 39 | private ArrayList avgcasecomplexities=new ArrayList(); 40 | private ArrayList spacecomplexities=new ArrayList<>(); 41 | public SearchDescription() { 42 | // Required empty public constructor 43 | } 44 | 45 | 46 | @Override 47 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 48 | Bundle savedInstanceState) { 49 | // Inflate the layout for this fragment 50 | View v= inflater.inflate(R.layout.fragment_search_description, container, false); 51 | searchdescription= (TextView) v.findViewById(R.id.searchdesc); 52 | bestcase= (TextView) v.findViewById(R.id.search_best); 53 | worstcase= (TextView) v.findViewById(R.id.search_worst); 54 | averagecase= (TextView) v.findViewById(R.id.search_average); 55 | space=(TextView)v.findViewById(R.id.search_space); 56 | bestcasecomplexities.add(0,"O(1)"); 57 | bestcasecomplexities.add(1,"O(1)"); 58 | worstcasecomplexities.add(0,"O(log n)"); 59 | worstcasecomplexities.add(1,"O(n)"); 60 | avgcasecomplexities.add(0,"O(log n)"); 61 | avgcasecomplexities.add(1,"O(n)"); 62 | spacecomplexities.add(0,"O(1)"); 63 | spacecomplexities.add(1,"O(1) iterative"); 64 | FirebaseDatabase database=FirebaseDatabase.getInstance(); 65 | reference=database.getReference("info_search"); 66 | reference.keepSynced(true); 67 | if(isNetworkAvailable()){ 68 | getSearchinginfo(); 69 | } 70 | else{ 71 | Toast.makeText(getActivity(),"Check your net connectivity",Toast.LENGTH_SHORT).show(); 72 | } 73 | return v; 74 | } 75 | 76 | private boolean isNetworkAvailable() { 77 | ConnectivityManager connectivityManager 78 | = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); 79 | NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); 80 | return activeNetworkInfo != null && activeNetworkInfo.isConnected(); 81 | } 82 | private void getSearchinginfo() { 83 | final ProgressDialog progressDialog=new ProgressDialog(getActivity()); 84 | progressDialog.setMessage("Loading..."); 85 | progressDialog.show(); 86 | reference.addValueEventListener(new ValueEventListener() { 87 | @Override 88 | public void onDataChange(DataSnapshot dataSnapshot) { 89 | for(DataSnapshot data:dataSnapshot.getChildren()){ 90 | for(DataSnapshot in:data.child("info_search").getChildren()){ 91 | searchinfo=in.getValue().toString(); 92 | for(DataSnapshot d:in.getChildren()){ 93 | searchinfoList.add(d.getValue().toString()); 94 | } 95 | } 96 | } 97 | switch (searchtitle){ 98 | case "Binary Search": 99 | String info=searchinfoList.get(0); 100 | searchdescription.setText(info); 101 | bestcase.setText("Best Case: "+bestcasecomplexities.get(0)); 102 | worstcase.setText("Worst Case: "+worstcasecomplexities.get(0)); 103 | averagecase.setText("Average Case: "+avgcasecomplexities.get(0)); 104 | space.setText(""+spacecomplexities.get(0)); 105 | progressDialog.cancel(); 106 | break; 107 | case "Linear Search": 108 | String info1=searchinfoList.get(1); 109 | searchdescription.setText(info1); 110 | bestcase.setText("Best Case: "+bestcasecomplexities.get(1)); 111 | worstcase.setText("Worst Case: "+worstcasecomplexities.get(1)); 112 | averagecase.setText("Average Case: "+avgcasecomplexities.get(1)); 113 | space.setText(""+spacecomplexities.get(1)); 114 | progressDialog.cancel(); 115 | break; 116 | } 117 | } 118 | @Override 119 | public void onCancelled(DatabaseError databaseError) { 120 | Log.e("SearchDescription","Error in Info "+databaseError.toException()); 121 | } 122 | }); 123 | 124 | 125 | } 126 | @Override 127 | public void onAttach(Context context) { 128 | super.onAttach(context); 129 | try { 130 | searchingActivity = (SearchingActivity) context; 131 | searchtitle=searchingActivity.getSearchName(); 132 | } 133 | catch (Exception e){ 134 | e.printStackTrace(); 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/SearchPrograms.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import com.developers.algoexplorer.Programs.SearchingPrograms; 13 | import com.developers.algoexplorer.R; 14 | import com.developers.algoexplorer.SearchingActivity; 15 | 16 | import thereisnospon.codeview.CodeView; 17 | import thereisnospon.codeview.CodeViewTheme; 18 | 19 | /** 20 | * A simple {@link Fragment} subclass. 21 | */ 22 | public class SearchPrograms extends Fragment { 23 | 24 | private CodeView searchprogram; 25 | private SearchingActivity searchingActivity; 26 | private String searchtitle; 27 | public SearchPrograms() { 28 | // Required empty public constructor 29 | } 30 | 31 | 32 | @Override 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 | Bundle savedInstanceState) { 35 | // Inflate the layout for this fragment 36 | View v1= inflater.inflate(R.layout.fragment_search_programs, container, false); 37 | searchprogram= (CodeView) v1.findViewById(R.id.program1); 38 | switch(searchtitle){ 39 | case "Binary Search": 40 | addSearchPrograms(SearchingPrograms.BINARY_SEARCH_PROGRAM); 41 | break; 42 | case "Linear Search": 43 | addSearchPrograms(SearchingPrograms.LINEAR_SEARCH_PROGRAM); 44 | break; 45 | } 46 | 47 | return v1; 48 | } 49 | 50 | private void addSearchPrograms(String source) { 51 | searchprogram.setTheme(CodeViewTheme.GITHUB); 52 | searchprogram.setHorizontalScrollBarEnabled(true); 53 | searchprogram.setVerticalScrollBarEnabled(true); 54 | searchprogram.setOnTouchListener(new View.OnTouchListener() { 55 | @Override 56 | public boolean onTouch(View view, MotionEvent motionEvent) { 57 | //view.getParent().requestDisallowInterceptTouchEvent(true); 58 | return false; 59 | } 60 | }); 61 | searchprogram.showCode(source); 62 | } 63 | 64 | @Override 65 | public void onAttach(Context context) { 66 | super.onAttach(context); 67 | try{ 68 | searchingActivity= (SearchingActivity) context; 69 | searchtitle=searchingActivity.getSearchName(); 70 | } 71 | catch (Exception e){ 72 | e.printStackTrace(); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/Searching.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.AdapterView; 11 | import android.widget.ListView; 12 | 13 | import com.developers.algoexplorer.R; 14 | import com.developers.algoexplorer.SearchingActivity; 15 | import com.developers.algoexplorer.adapters.CustomListSearchingAdapter; 16 | 17 | import java.util.ArrayList; 18 | 19 | /** 20 | * A simple {@link Fragment} subclass. 21 | */ 22 | public class Searching extends Fragment { 23 | 24 | private ArrayList searchname=new ArrayList(); 25 | private ListView searchList; 26 | private CustomListSearchingAdapter adapter; 27 | private Intent intent; 28 | public Searching() { 29 | // Required empty public constructor 30 | } 31 | 32 | 33 | @Override 34 | public View onCreateView(final LayoutInflater inflater, ViewGroup container, 35 | Bundle savedInstanceState) { 36 | // Inflate the layout for this fragment 37 | View v1= inflater.inflate(R.layout.fragment_searching, container, false); 38 | searchname.add(0,"Linear Search"); 39 | searchname.add(1,"Binary Search"); 40 | searchList=(ListView)v1.findViewById(R.id.list2); 41 | adapter=new CustomListSearchingAdapter(getActivity(),searchname); 42 | searchList.setAdapter(adapter); 43 | searchList.setOnItemClickListener(new AdapterView.OnItemClickListener() { 44 | @Override 45 | public void onItemClick(AdapterView adapterView, View view, int i, long l) { 46 | intent=new Intent(getActivity(), SearchingActivity.class); 47 | intent.putExtra("searchname",searchname.get(i)); 48 | startActivity(intent); 49 | } 50 | }); 51 | return v1; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/SearchingAlgorithms.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import com.developers.algoexplorer.Algorithms.SearchingAlgos; 13 | import com.developers.algoexplorer.R; 14 | import com.developers.algoexplorer.SearchingActivity; 15 | 16 | import thereisnospon.codeview.CodeView; 17 | import thereisnospon.codeview.CodeViewTheme; 18 | 19 | /** 20 | * A simple {@link Fragment} subclass. 21 | */ 22 | public class SearchingAlgorithms extends Fragment { 23 | private SearchingActivity searchingActivity; 24 | private String searchname; 25 | private CodeView algo; 26 | public SearchingAlgorithms() { 27 | // Required empty public constructor 28 | } 29 | 30 | 31 | @Override 32 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 33 | Bundle savedInstanceState) { 34 | // Inflate the layout for this fragment 35 | View v2= inflater.inflate(R.layout.fragment_searching_algorithms, container, false); 36 | algo= (CodeView) v2.findViewById(R.id.searchalgorithm); 37 | switch(searchname){ 38 | case "Binary Search": 39 | addAlgos(SearchingAlgos.BINARY_SEARCH_ALGORITHM); 40 | break; 41 | case "Linear Search": 42 | addAlgos(SearchingAlgos.LINEAR_SEARCH_ALGORITHM); 43 | break; 44 | } 45 | return v2; 46 | } 47 | 48 | private void addAlgos(String algocode) { 49 | algo.setTheme(CodeViewTheme.GITHUB); 50 | algo.setHorizontalScrollBarEnabled(true); 51 | algo.setVerticalScrollBarEnabled(true); 52 | algo.setOnTouchListener(new View.OnTouchListener() { 53 | @Override 54 | public boolean onTouch(View view, MotionEvent motionEvent) { 55 | //view.getParent().requestDisallowInterceptTouchEvent(true); 56 | return false; 57 | } 58 | }); 59 | algo.showCode(algocode); 60 | } 61 | 62 | @Override 63 | public void onAttach(Context context) { 64 | super.onAttach(context); 65 | try { 66 | searchingActivity = (SearchingActivity) context; 67 | searchname=searchingActivity.getSearchName(); 68 | } 69 | catch (Exception e){ 70 | e.printStackTrace(); 71 | } 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/Sorting.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.AdapterView; 11 | import android.widget.ListView; 12 | 13 | import com.developers.algoexplorer.R; 14 | import com.developers.algoexplorer.SortingActivity; 15 | import com.developers.algoexplorer.adapters.CustomListSortingAdapter; 16 | 17 | import java.util.ArrayList; 18 | 19 | 20 | /** 21 | * A simple {@link Fragment} subclass. 22 | */ 23 | public class Sorting extends Fragment { 24 | private ArrayList sortname; 25 | private ListView mList; 26 | private CustomListSortingAdapter adapter; 27 | ; private Intent intent; 28 | public Sorting() { 29 | // Required empty public constructor 30 | } 31 | 32 | 33 | @Override 34 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 35 | Bundle savedInstanceState) { 36 | // Inflate the layout for this fragment 37 | View v= inflater.inflate(R.layout.fragment_sorting, container, false); 38 | sortname=new ArrayList(); 39 | sortname.add("Bubble Sort"); 40 | sortname.add("Merge Sort"); 41 | sortname.add("Insertion Sort"); 42 | sortname.add("Quick Sort"); 43 | sortname.add("Heap Sort"); 44 | sortname.add("Selection Sort"); 45 | mList= (ListView) v.findViewById(R.id.list); 46 | adapter=new CustomListSortingAdapter(getActivity(),sortname); 47 | mList.setAdapter(adapter); 48 | mList.setOnItemClickListener(new AdapterView.OnItemClickListener() { 49 | @Override 50 | public void onItemClick(AdapterView parent, View view, int position, long id) { 51 | intent=new Intent(getActivity(),SortingActivity.class); 52 | intent.putExtra("sortname",sortname.get(position)); 53 | startActivity(intent); 54 | } 55 | }); 56 | return v; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/developers/algoexplorer/fragments/VisualGraph.java: -------------------------------------------------------------------------------- 1 | package com.developers.algoexplorer.fragments; 2 | 3 | 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.graphics.Paint; 7 | import android.graphics.Path; 8 | import android.graphics.Point; 9 | import android.os.Bundle; 10 | import android.support.v4.app.Fragment; 11 | import android.util.Log; 12 | import android.view.LayoutInflater; 13 | import android.view.View; 14 | import android.view.ViewGroup; 15 | import android.widget.TextView; 16 | 17 | import com.db.chart.Tools; 18 | import com.db.chart.model.LineSet; 19 | import com.db.chart.renderer.AxisRenderer; 20 | import com.db.chart.view.LineChartView; 21 | import com.developers.algoexplorer.MainActivity; 22 | import com.developers.algoexplorer.R; 23 | import com.google.android.gms.ads.AdRequest; 24 | import com.google.android.gms.ads.AdView; 25 | import com.google.android.gms.ads.MobileAds; 26 | 27 | /** 28 | * A simple {@link Fragment} subclass. 29 | */ 30 | public class VisualGraph extends Fragment { 31 | 32 | 33 | public VisualGraph() { 34 | // Required empty public constructor 35 | } 36 | 37 | private LineSet ngraph,nsqgraph,nlograph,lograph; 38 | private Paint paint1,paint2,paint3,paint4; 39 | private LineChartView lineChartView; 40 | private TextView graphdetail; 41 | private AdView adView; 42 | @Override 43 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 44 | Bundle savedInstanceState) { 45 | // Inflate the layout for this fragment 46 | View v3= inflater.inflate(R.layout.fragment_visual_graph, container, false); 47 | lineChartView= (LineChartView) v3.findViewById(R.id.linechart); 48 | graphdetail= (TextView) v3.findViewById(R.id.graphdetail); 49 | adView= (AdView) v3.findViewById(R.id.adView); 50 | MobileAds.initialize(getActivity(), 51 | "ca-app-pub-3940256099942544~3347511713"); 52 | AdRequest request = new AdRequest.Builder() 53 | .addTestDevice("CFF347E1F13269C9C8B2BFEAD3E6C7EC") 54 | .build(); 55 | adView.loadAd(request); 56 | ngraph=new LineSet(); 57 | nsqgraph=new LineSet(); 58 | nlograph=new LineSet(); 59 | lograph=new LineSet(); 60 | paint1=new Paint(); 61 | paint2=new Paint(); 62 | paint3=new Paint(); 63 | paint4=new Paint(); 64 | for(int i=0;i<500;i++){ 65 | ngraph.addPoint("",i); 66 | } 67 | for(int j=0;j<500;j++){ 68 | nsqgraph.addPoint("",(j*j)); 69 | } 70 | for(float k=0;k<500;k++){ 71 | if(k==0) { 72 | nlograph.addPoint("",0); 73 | } 74 | else { 75 | nlograph.addPoint("", (float) (k * Math.log(k))); 76 | } 77 | } 78 | for(float p=0;p<500;p++){ 79 | if(p==0) { 80 | lograph.addPoint("",0); 81 | } 82 | else { 83 | lograph.addPoint("", (float) (Math.log(p))); 84 | } 85 | } 86 | paint1.setColor(Color.BLACK); 87 | paint1.setStyle(Paint.Style.STROKE); 88 | paint1.setAntiAlias(true); 89 | paint1.setStrokeWidth(Tools.fromDpToPx(1f)); 90 | 91 | paint2.setColor(Color.BLACK); 92 | paint2.setStyle(Paint.Style.STROKE); 93 | paint2.setAntiAlias(true); 94 | paint2.setStrokeWidth(Tools.fromDpToPx(1f)); 95 | 96 | paint3.setColor(Color.BLACK); 97 | paint3.setStyle(Paint.Style.STROKE); 98 | paint3.setAntiAlias(true); 99 | paint3.setStrokeWidth(Tools.fromDpToPx(1f)); 100 | 101 | lineChartView.setBorderSpacing(1) 102 | .setAxisBorderValues(0, 1000) 103 | .setXLabels(AxisRenderer.LabelPosition.OUTSIDE) 104 | .setYLabels(AxisRenderer.LabelPosition.OUTSIDE) 105 | .setLabelsColor(Color.BLUE) 106 | .setXAxis(false) 107 | .setYAxis(false) 108 | .setBorderSpacing(Tools.fromDpToPx(5)).setGrid(5,0,paint1); 109 | 110 | if(ngraph.size()>0){ 111 | lineChartView.addData(ngraph); 112 | lineChartView.addData(nsqgraph); 113 | lineChartView.addData(nlograph); 114 | lineChartView.addData(lograph); 115 | lineChartView.show(); 116 | } 117 | String des=getResources().getString(R.string.visual_disc); 118 | graphdetail.setText(des); 119 | return v3; 120 | } 121 | 122 | 123 | } 124 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/binarysearch_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/binarysearch_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/binomial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/binomial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/binomial_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/binomial_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/bubble.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/bubble.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/bubblesort_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/bubblesort_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/dijkstra_animation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/dijkstra_animation.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/dijkstra_list.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/dijkstra_list.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/floyd_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/floyd_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/floydwarshall.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/floydwarshall.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/heapsort.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/heapsort.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/heapsort_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/heapsort_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_camera.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_gallery.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_manage.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_send.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_share.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/ic_menu_slideshow.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/insertionsort.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/insertionsort.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/insertionsort_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/insertionsort_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/knapsack.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/knapsack.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/knapsack_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/knapsack_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/lcs.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/lcs.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/linearsearch_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/linearsearch_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/longest_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/longest_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/mcm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/mcm.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/mcm_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/mcm_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/mergesort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/mergesort.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/mergesort_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/mergesort_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/navbg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/navbg.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/quicksort.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/quicksort.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/quicksort_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/quicksort_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/searchingalgo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/searchingalgo.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/selection.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/selection.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/selectionsort_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable-v21/selectionsort_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/binarysearch_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/binarysearch_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/binomial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/binomial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/binomial_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/binomial_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/bubble.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/bubble.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/bubblesort_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/bubblesort_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/dijkstra_animation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/dijkstra_animation.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/dijkstra_list.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/dijkstra_list.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/floyd_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/floyd_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/floydwarshall.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/floydwarshall.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/heapsort.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/heapsort.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/heapsort_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/heapsort_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/insertionsort.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/insertionsort.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/insertionsort_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/insertionsort_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/knapsack.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/knapsack.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/knapsack_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/knapsack_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/lcs.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/lcs.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/linearsearch_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/linearsearch_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/longest_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/longest_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/mcm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/mcm.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/mcm_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/mcm_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/mergesort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/mergesort.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/mergesort_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/mergesort_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/navbg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/navbg.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/quicksort.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/quicksort.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/quicksort_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/quicksort_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/searchingalgo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/searchingalgo.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/selection.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/selection.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/selectionsort_list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/drawable/selectionsort_list.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/side_nav_bar.xml: -------------------------------------------------------------------------------- 1 | 3 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 15 | 19 | 26 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_dynamic.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 17 | 18 | 26 | 27 | 34 | 41 | 47 | 55 | 65 | 66 | 67 | 68 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_graph.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 17 | 18 | 26 | 27 | 34 | 35 | 41 | 42 | 50 | 59 | 60 | 61 | 62 | 67 | 68 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_searching.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 17 | 18 | 26 | 27 | 34 | 35 | 40 | 41 | 49 | 58 | 59 | 60 | 61 | 66 | 67 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_sorting.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 17 | 18 | 26 | 33 | 40 | 41 | 47 | 48 | 56 | 65 | 66 | 67 | 68 | 69 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /app/src/main/res/layout/app_bar_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_algorithm.xml: -------------------------------------------------------------------------------- 1 | 6 | 11 | 15 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_description.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 12 | 16 | 23 | 30 | 39 | 48 | 55 | 62 | 69 | 77 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_dynamic.xml: -------------------------------------------------------------------------------- 1 | 7 | 15 | 20 | 28 | 36 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_dynamic_algorithms.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 14 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_dynamic_description.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 14 | 21 | 29 | 36 | 43 | 52 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_dynamic_example.xml: -------------------------------------------------------------------------------- 1 | 6 | 11 | 12 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_dynamic_programs.xml: -------------------------------------------------------------------------------- 1 | 6 | 11 | 15 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_graph_algorithms.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 14 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_graph_description.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 11 | 15 | 22 | 31 | 38 | 47 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_graph_programs.xml: -------------------------------------------------------------------------------- 1 | 6 | 11 | 12 | 16 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_graphs.xml: -------------------------------------------------------------------------------- 1 | 7 | 15 | 20 | 28 | 36 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_program.xml: -------------------------------------------------------------------------------- 1 | 6 | 11 | 12 | 16 | 17 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_search_description.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 14 | 21 | 28 | 37 | 46 | 53 | 60 | 67 | 75 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_search_programs.xml: -------------------------------------------------------------------------------- 1 | 6 | 11 | 15 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_searching.xml: -------------------------------------------------------------------------------- 1 | 7 | 15 | 20 | 28 | 36 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_searching_algorithms.xml: -------------------------------------------------------------------------------- 1 | 6 | 11 | 15 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_sorting.xml: -------------------------------------------------------------------------------- 1 | 7 | 15 | 20 | 28 | 36 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_visual_graph.xml: -------------------------------------------------------------------------------- 1 | 8 | 12 | 18 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_dynamic_row.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 16 | 22 | 27 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_graph_row.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 16 | 22 | 27 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_search_row.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 16 | 22 | 27 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_sort_row.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 16 | 22 | 27 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/nav_header_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/menu/activity_main_drawer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 11 | 14 | 17 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanjeetsingh150/Algo-Explorer/7376b8ac74b6eebb64cc2474e459491d5109e319/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #2e7d32 4 | #1B5E20 5 | #FF4081 6 | #fff 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 160dp 5 | 6 | 16dp 7 | 16dp 8 | 16dp 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/drawables.xml: -------------------------------------------------------------------------------- 1 | 2 | @android:drawable/ic_menu_camera 3 | @android:drawable/ic_menu_gallery 4 | @android:drawable/ic_menu_slideshow 5 | @android:drawable/ic_menu_manage 6 | @android:drawable/ic_menu_share 7 | @android:drawable/ic_menu_send 8 | @drawable/navbg 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Algo Explorer 3 | Open navigation drawer 4 | Close navigation drawer 5 | Sorting refers to arranging data in a particular format. Sorting algorithm specifies the way to arrange data in a particular order. Most common orders are in numerical or lexicographical order. 6 | Settings 7 | Sorting 8 | A search algorithm is the step-by-step procedure used to locate specific data among a collection of data. It is considered a fundamental procedure in computing. In computer science, when searching for data, the difference between a fast application and a slower one often lies in the use of the proper search algorithm. 9 | 10 | Hello blank fragment 11 | Searching 12 | Dynamic Programming 13 | Graphs 14 | In computer science, Dynamic Programming is a complex problem by breaking it down into a collection of simpler subproblems, solving each of those subproblems just once, and storing their solutions – ideally, using a memory-based data structure. 15 | Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible. This problem is solved by DP. 16 | We can define m[i,w] to be the maximum value that can be attained with weight less than or equal to w using items up to i as:\n• m[0,w]=0\n• m[i,w]=m[i-1,w] if wi>w\n• m[i,w]=max(m[i-1,w],m[i-1,w-wi]+vi) if wi is less than equal to w 17 | Computing binomial coefficients is non optimization problem but can be solved using dynamic programming.\nBinomial coefficients are represented by C(n, k) or (nk) and can be used to represent the coefficients of a binomail:\n(a + b)^n = C(n, 0)a^n + ... + C(n, k)a^n-kbk + ... + C(n, n)b^n 18 | C(n, k) = C(n-1, k-1) + C(n-1, k) for n > k > 0\nC(n, 0) = C(n, n) = 1 19 | The longest common subsequence or LCS is the problem of finding the longest subsequence common to all sequences in a set of sequences (often just two sequences). It can also be solved by Dynamic Programming. For eg. LCS for input Sequences “ABCDGH” and “AEDFHR” is “ADH” of length 3. 20 | Given string X with length m, string Y with length n\n1. If m=0 or n=0 then 0\n2. If(X[i]==Y[j]) then 1+lcs(x,y,m-1,n-1)\n3. else max(lcs(X, Y, m, n-1), lcs(X, Y, m-1, n)) 21 | Matrix chain Multiplication or MCM is an optimization problem that can be solved by Dynamic Programming. It states: Given a sequence of matrices, the goal is to find the most efficient way to multiply these matrices. The problem is not actually to perform the multiplications, but merely to decide the sequence of the matrix multiplications involved such that there are minimum number of multiplication operations involved. 22 | m[i,j]=0 if i==j\nmin{m[i,k]+m[k+1,j]+pi − 1 . pk . pj} if i is less than j\nwhere m[i,j] is minimum number of scalar multiplications\n and p array can be obtained by order of matrices. 23 | A graph is an abstract notation used to represent the connection between pairs of nodes. The algorithms dealing with problem related with graphs comes in this section. 24 | The Floyd–Warshall algorithm is an algorithm for finding shortest paths in a weighted graph with positive or negative edge weights (but with no negative cycles). It considers vertices of simple path P from i to j considering k vertices as intermediate. k takes values as shown in above solved example. The solution evaluated is by the technique of Dynamic Programming. 25 | Dijkstra algorithm solves shortest path problems between nodes in graph. Dijkstra algorithm to find the shortest path between a and b. It picks the unvisited vertex with the lowest distance, calculates the distance through it to each unvisited neighbor, and updates the neighbor distance if smaller. Mark visited (set to red) when done with neighbors. This is depicted in above example. 26 | From above plot counting from the topmost curve:-\n1.O(n^2)\n2.O(n*log n)\n3.O(n)\n4.O(log n) 27 | AlgoExplorer is developed in keeping view about all type of the users from the school students to an expert. It contains all the relevant things about the algorithms that is programs, descriptions, psuedocode and examples. The topics covered till now in this version are as follows:\n1.Sorting\n2.Searching\n3.Dynamic Programming\n4.Graphs. Credits to the following websites :- 1. http://piratelearner.com\n2. https://wikimedia.org/wikipedia/\n3. http://www.personal.kent.edu/\n4. www.penjee.com\n5. https://www.cs.usfca.edu\n6. Wikipedia\n7.GeeksforGeeks. \nThe application is open sourced at following link feel free to contribute:- 28 | ca-app-pub-3521141993095148~6203076317 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 |