From 96e5629616a91142b3643ce0046642f49686c355 Mon Sep 17 00:00:00 2001 From: Rehan Guha Date: Wed, 1 Jul 2020 01:39:35 +0530 Subject: [PATCH] Added Python, Structured Repo --- .gitignore | 2 + GridSearching.cpp => C++/GridSearching.cpp | 2 +- LinearSearch.cpp => C++/LinearSearch.cpp | 0 a.out => C++/a.out | Bin Python/GridSearching.py | 78 ++++++++++++ q.cpp | 135 --------------------- 6 files changed, 81 insertions(+), 136 deletions(-) create mode 100644 .gitignore rename GridSearching.cpp => C++/GridSearching.cpp (96%) rename LinearSearch.cpp => C++/LinearSearch.cpp (100%) rename a.out => C++/a.out (100%) create mode 100644 Python/GridSearching.py delete mode 100755 q.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd5d2ec --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vscode +gridsearching_dev \ No newline at end of file diff --git a/GridSearching.cpp b/C++/GridSearching.cpp similarity index 96% rename from GridSearching.cpp rename to C++/GridSearching.cpp index ad520d5..2b0385c 100755 --- a/GridSearching.cpp +++ b/C++/GridSearching.cpp @@ -114,7 +114,7 @@ int grid_search(int arr[MAX][MAX],int NUM,int n=MAX) int main() { - int arr[MAX][MAX]={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}; + int arr[MAX][MAX]={{71,2,3,84},{5,66,7,8},{9,180,11,182},{413,3414,515,126}}; int num; cout<<"Enter no.:"; cin>>num; diff --git a/LinearSearch.cpp b/C++/LinearSearch.cpp similarity index 100% rename from LinearSearch.cpp rename to C++/LinearSearch.cpp diff --git a/a.out b/C++/a.out similarity index 100% rename from a.out rename to C++/a.out diff --git a/Python/GridSearching.py b/Python/GridSearching.py new file mode 100644 index 0000000..97cafc3 --- /dev/null +++ b/Python/GridSearching.py @@ -0,0 +1,78 @@ +def _range(n): + t = 0 + if n % 3 == 1: + t = ((n+2)/3) + elif n%3 == 2: + t = ((n+1)/3) + else: + t=((n)/3) + return t*t + +def check(A, i, j, NUM, dim): + if ((i>=0 and i=0 and j - -using namespace std; - -#define MAX 200 - -int f_i,f_j; - - -int check(int arr[MAX][MAX],int i,int j,int num,int n=MAX) -{ - if(((i>=0) && (i=0) && (j>num; - cout<<"\nResult:\n"; - if(grid_search(arr,num)) - { - - cout<<"\n"<