This is a repository containing various python programs to understand the basic concepts of Data Structures and Algorithms.
-
Python Code for solving 0-1 Knapsack problem.
-
Python Code for solving Fractional Knapsack problem.
-
Longest Common Subsequence (LCS):
Python Code for solving Longest Common Subsequence (LCS) problem.
-
Python Code for implementing a Linked List.
-
Python Code for implementing Linked List reversal.
-
Python Code for implementing a Queue.
-
Python Code for implementing a queue using two stacks.
-
Python Code for implementing a queue using a single stack (using recursion).
-
Python Code for implementing a Stack.
-
Python Code for implementing a stack using two queues.
-
Python Code for implementing a stack using a single queue.
-
Python Code for performing Merge Sort.
-
Python Code for performing Quick Sort.
-
Python Code for performing Randomized version of Quick Sort.
-
Python Code for performing Insertion Sort.
-
Python Code for performing Bubble Sort.
-
Python Code for performing Selection Sort.
-
Python Code for performing Linear Search operation to search for the position of an element in an array.
-
Python Code for performing Binary Search operation Recursively to search for the position of an element in an array.
-
Python Code for performing Binary Search operation Iteratively to search for the position of an element in an array.
-
Python Code for checking the balancing of Parenthesis.
-
Generate Balanced Parenthesis:
Python Code to generate balanced parenthesis of the given order.
-
Decreasing Frequency-Wise Array Sorting:
Python Code for performing decreasing frequency-wise sorting of a given array.
-
Checking Sorting of Array with atmost One Swapping of Elements:
Python Code for checking whether it is possible or not to sort the given array by doing atmost one swapping of elements.
-
Rotate Square Matrix by 90 Degrees in Anti-Clockwise Direction:
Python Code for rotating the elements of the matrix by 90 degrees in anti-clockwise direction.
-
Second Method to rotate Square Matrix by 90 Degrees in Anti-Clockwise Direction:
Python Code for rotating the elements of the matrix by 90 degrees in anti-clockwise direction by transposing the array and reversing the elements column-wise.
-
Rotate Square Matrix by 90 Degrees in Clockwise Direction:
Python Code for rotating the elements of the matrix by 90 degrees in clockwise direction.
-
Finding Pair of Elements with given Sum in an Array:
Python Code for finding the pair of elements in an array whose sum is equal to a particular sum entered by the user.
-
Finding Pair of Elements with given Sum in an Array using Hashing Method:
Python Code for finding all the pairs of elements in an array whose sum is equal to a particular sum entered by the user by using the hashing set method.
-
Finding the Pythgorean Triplets present in an Array:
Python Code for finding the triplet of elements present in an array which act as a Pythagorean Triplet.
-
Generating the Pythgorean Triplets till a particular Limit:
Python Code for generating the Pythagorean Triplets having values less than a limit entered by a user.
-
Number Occurring Odd no. of Times in an Array:
Python Code for finding the number which occurs odd no. of times in the given array.
-
Largest Contiguous Sum in an Array:
Python Code for finding the largest contiguous sum present in the given array.
-
Segregate 0s and 1s in an Array:
Python Code for segregating 0s and 1s in the given array.
-
Second Largest Element in an Array:
Python Code for finding the second largest element present in the given array.
-
First Non-Repeating Character in an String:
Python Code for finding the first non-repeating character present in the given string.
-
Remove Duplicates from a Sorted Array:
Python Code for removing duplicate elements present in a sorted array.
-
Check Binary Representation of a number is Palidrome or not:
Python Code for checking whether binary representation of a number is palindrome or not.
-
Check whether two strings are anagrams of each other:
Python Code for checking whether two given strings are anagrams of each other.
-
Rotation Count in a Rotated Sorted Array:
Python Code for finding the rotation count in a rotated sorted array.
-
Python Code for solving a popular problem of the Pavement of Roads to connect to Libraries in the City/Cities.
-
Python Code for finding the minimum number of swapping of numbers required to sort the array given as input.