This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __author__='Sudhanshu Patel' | |
| ''' | |
| Binary search tree implementation | |
| # goes left if key less than node.key else right | |
| 1. insetion | |
| 2. Preorder | |
| 3. postorder | |
| 4. inorder traversal | |
| 5. find max depth | |
| 6. print all leaf node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Destructer delete object by itself when its reference is 0 | |
| from abc import ABC, ABCMeta, abstractclassmethod | |
| ''' | |
| Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, | |
| but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide | |
| implementations for the abstract methods. | |
| ''' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from abc import ABC, ABCMeta, abstractclassmethod | |
| ''' | |
| Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, | |
| but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide | |
| implementations for the abstract methods. | |
| ''' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Sudhanshu Patel -sudhanshuptl13@gmail.com */ | |
| #include<stdio.h> | |
| #include<stdlib.h> | |
| struct Node{ | |
| int data; | |
| struct Node *next; | |
| }; | |
| typedef struct Node Node; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __author__ == 'Sudhanshu Patel' | |
| ''' | |
| 1. Height should be h or h-1 | |
| 2. max heap : parent node have hire value than all of its children | |
| ''' | |
| class Heap_Array(object): | |
| # Array Implementation of max Heap | |
| # parent of a node is (i-1)/2 and child of a node is 2*i+1 and 2*i+2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # One Way Link List | |
| ''' | |
| 1. Insertion at beginning | |
| 2. Insertion at end | |
| 3. Insertion at given postion | |
| 4. deletion from beginning | |
| 5. deletion from the end | |
| 6. deletion from given postion | |
| ''' | |
| class Node: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<string.h> | |
| int main(){ | |
| FILE *fp; //file pointer | |
| char line[30]; | |
| char *token; | |
| //open file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<string.h> | |
| #include<stdlib.h> | |
| /*Global Variabls*/ | |
| char *GlobalPointer=NULL; | |
| /* Prototypes */ | |
| char *ParseLine(char *arr, char *delimiter); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Bubble sort in python | |
| __author__ ='Sudhashu Patel' | |
| class BubbleSort: | |
| def __init__(self, ls=[5,3,6,2,4,7,4,3]): | |
| self.ls = ls | |
| self.length = len(self.ls) | |
| def sort(self, reverse=False): | |
| if reverse: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #define SIZE 10 | |
| void print(int arr[]); | |
| void mergeSort(int arr[],int base,int end); | |
| void merge(int arr[],int base,int mid, int end); | |
| int main(){ | |
| int arr[SIZE]={5,32,7,2,8,7,9,6,43,65}; | |
| print(arr); |
OlderNewer