File tree Expand file tree Collapse file tree 3 files changed +70
-0
lines changed Expand file tree Collapse file tree 3 files changed +70
-0
lines changed Original file line number Diff line number Diff line change
1
+ .idea
2
+ .idea /**
3
+ __pycache__
4
+ pychache__ /**
5
+ ** /pychache__ /**
Original file line number Diff line number Diff line change
1
+ ## Data Structures and Algorithms using Python
2
+ ## Algorithms characteristics:
3
+ Algorithms have associated complexity:
4
+ * space -> memory occupied
5
+ * time -> time taken to complete task irrespective of input size
6
+ * They have set of input and produces output
7
+
8
+ #Algorithms classification
9
+ * series-> sequential fashion
10
+ * parallel -> break data set and work on each simultaneously
11
+ * exact -> provides exact value as output
12
+ * approximate -> output may or may not be exact e.g. face recognition
13
+ * deterministic -> steps know
14
+ * non-deterministic -> based on guesses
15
+
16
+ ## Types of Algorithms
17
+ * searching -> search specific data in a larger data
18
+ * sorting -> sort a dataset
19
+ * computational -> take one data set and return another data set
20
+ * collection -> navigating through elements in a dataset
21
+
22
+ ## Algorithms performance
23
+ Big-O notation: classifies performance as input size grows. O represents order of operation
24
+ <table >
25
+ <tr >
26
+ <th>Notation</th>
27
+ <th>Description</th>
28
+ </tr >
29
+ <tr >
30
+ <td>O(1)</td>
31
+ <td>Constant</td>
32
+ </tr >
33
+ <tr >
34
+ <td>O(log n)</td>
35
+ <td>Logarithmic</td>
36
+ </tr >
37
+ <tr >
38
+ <td>O(n)<br></td>
39
+ <td>Linear time</td>
40
+ </tr >
41
+ <tr >
42
+ <td>O(nlogn)</td>
43
+ <td>Log-linear</td>
44
+ </tr >
45
+ <tr >
46
+ <td>O(n^2)</td>
47
+ <td>Quadratic</td>
48
+ </tr >
49
+ </table >
Original file line number Diff line number Diff line change
1
+ '''
2
+ Find gcd of two given number using Euclid's algorithms
3
+ '''
4
+
5
+
6
+ def gcd (a , b ):
7
+ while b != 0 :
8
+ t = a
9
+ a = b
10
+ b = t % b
11
+ return a
12
+
13
+
14
+ if __name__ == '__main__' :
15
+ print (gcd (60 , 96 ))
16
+ print (gcd (20 , 8 ))
You can’t perform that action at this time.
0 commit comments