Wa0018
Wa0018
PAGE
S. No Date PROGRAM
NUMBER
1. 15/07/2024 Recursive Technique 2
2. 16/07/2024 Iterative and Recursive Technique 3
3. 23/07/2024 Implementation of Doubly Linked List Data Structure 5
4 25/07/2024 Implementation of Stack Data Structure using append and pop 7
functions
5. 29/08/2024 Implementation of Stack Data Structure 9
6. 30/08/2024 Creation of Heap using Algorithm Heapify 10
7. 30/08/2024 Insertion into a Heap Data Structure 11
8. 30/08/2024 Creating a Heap using Algorithm Insert 12
9. 30/08/2024 Iterative and Recursive Technique 13
10. 06/09/2024 Divide and Conquer Paradigm: Search Algorithm 14
11. 06/09/2024 Divide and Conquer Paradigm: Search Algorithm 16
12. 12/09/2024 Partitioning the elements of the array 18
13. 12/09/2024 Merging of Two Sorted Arrays 20
14. 12/09/2024 Divide and Conquer Paradigm: Sorting the array by Partitioning 21
15. 12/09/2024 Divide and Conquer Paradigm: Selecting the kth smallest number 22
16. 12/09/2024 Divide and Conquer Paradigm: Sorting Problem 24
17. 12/09/2024 Divide and Conquer Paradigm: Finding Maximum and Minimum 25
18 12/09/2024 Application of Array data structure using modules 26
19 12/09/2024 Application of Array data structure 27
20 12/09/2024 Application of Stack Data Structure 28
21 12/09/2024 Applications of Deque Data Structure 29
22 12/09/2024 Sorting using heap data structure 30
23 12/09/2024 Implementation of Circular Queue Data Structure 31
24 19/09/2024 Operations on Binary Search Tree Data Structure 33
25 19/09/2024 Operations on Heap Data Structure: Deletion 36
26 19/09/2024 Implementation of Binary Search Tree Data Structure 38
27 25/09/2024 Implementation of Dynamic Array Data Structure 40
28 25/09/2024 Techniques for Algorithm Design: Greedy Algorithm – Knapsack 43
Problem
29 04/10/2024 Techniques for Algorithm Design: Dynamic Programming-Longest 44
Common Subsequence Problem
30 04/10/2024 Techniques for Algorithm Design: Backtracking: Sum of Subset 45
Problem
31 04/10/2024 Huffman Coding 46
32 04/10/2024 Techniques for Algorithm Design: Greedy Algorithm – Optimal 48
Storage on Tapes Problem
33 04/10/2024 Graph Traversal Technique: Depth First Search 50
34 04/10/2024 52
35 04/10/2024 Techniques for Algorithm Design: Greedy Algorithm – Minimum 55
Spanning Tree Problem
36 04/10/2024 Techniques for Algorithm Design: Greedy Algorithm – Minimum 57
Spanning Tree Problem
37 04/10/2024 Tree Traversal Technique 60
24-PMT-032 Page |2
Recursive Technique
DATE: 15/07/2024
PROGRAM NO.: 01 Create a script to print all possible permutations of the set {𝑙, 𝑚, 𝑛}.
Python Code:
Output:
Python Code:
RECURSIVE METHOD
Output:
ITERATIVE METHOD
Output:
Python Code:
Output:
Python code:
INPUT:
OUTPUT:
Python code:
Output:
Python code:
INPUT:
OUTPUT:
Design a code to insert an element into a heap. Use the code to insert the data 25,
PROGRAM NO:7 13 into the heap represented by a[0 : 7] = (30, 17, 20, 15, 10, 12, 5, 1).
Python code:
Input:
Output:
DATE: 30/08/2024
Creating a Heap using Algorithm Insert
Design a code to form a heap using Algorithm Insert. Run the code on the data 45,
PROGRAM NO.: 8
5, 65, 25, 85, 55, 95, 15, 75.
Python code:
INPUT:
Output:
Give the code for finding the binomial coefficient in iterative and recursive form.
PROGRAM NO:9 What is the output when m = 15 and n = 5.
Output:
Output:
python code:
Input:
Output:
Suppose a [0 : 15] = (– 5, – 2, – 1, 0, 3, 5, 5, 8, 10, 13, 16, 18, 21, 29, 32, 39).
Applying Bin Srch (a, l, h, x) what would be the output when x = – 3, 3, 33.
Python code:
Input:
Output:
Python code:
Output:
Python code:
Input:
Output:
Python code:
Output:
PYTHON CODE:
Output:
Execute the code on the array a[1 : 11] = (111, 85, 16, 67, 34, 56, 44, 91, 125,
7, 11).
PYTHON CODE:
Output:
PYTHON CODE:
Output:
Python CODE:
output:
PYTHON CODE:
Output:
Design a recursive method to reverse a string using stack data structure. Execute
PROGRAM NO:20 the code on the string ‘ssDeQwJIOffB’ then display the output.
PYTHON CODE:
Output:
PYTHON CODE:
Output:
PROGRAM NO.: 22
Use the code to sort the array a[0 : 10] = (44, 14, 84, 104, 94, 54, 84, 24, 34, 124,
4) and produce the output.
PYTHON CODE:
Output:
Input:
Output:
PYTHON CODE:
Output
PROGRAM NO.: 25
Execute the code on the heap represented by a[0: 10] = (97, 87, 90, 77, 67, 80, 60,
57, 37, 7, 47) to delete the maximum element. Use import statement to load
definitions from a module.
PYTHON CODE:
Output
PYTHON CODE:
Input:
Output:
PYTHON CODE:
Output
PYTHON CODE:
Output
PYTHON CODE:
Output:
PROGRAM NO:
30
Use the code to identify all feasible subsets of w that sums to m if w = {5, 10, 15, 17,
18, 20, 35, 40} and m = 80.
PYTHON CODE:
Output:
PYTHON CODE:
Output
DATE: 04/10/2024
Techniques for Algorithm Design:
Greedy Algorithm – Optimal Storage on Tapes Problem
Devise a Python program to determine the optimal storage on m tapes with the
minimum mean retrieval time if there are n programs, each of which is of length li,
1 i n. Also, give a function for input and output statemnents.
PROGRAM NO:32
With the programs having lengths of 34, 55, 65, 12, 90, 47, 23, 11, 81, 72, 3, 16,
95, 6, 12, 61, 75, 62, 57, 39 employ the code to determine the optimal arrangement
for the 20 programs on the four tapes T0, T1, T2, T3 and T4.
PYTHON CODE:
Output:
DATE:
04/10/2024 Graph Traversal Technique: Depth First Search
Construct the depth-first search traversal algorithm's Python code.
Stretch a graph with 14 vertices and 20 edges and determine the spanning tree of the
PROGRAM
NO:33 graph
PYTHON CODE:
Output:
DATE: 04/10/2024
Techniques for Algorithm Design:
Greedy Algorithm – Single-Source Shortest Path Problem
Create a Python program to implement the specified algorithm:
PROGRAM NO.: 34
Compute the shortest path between the vertex d and every other vertex in the graph
by using the code.
c
a d
h
b g j
To any seven edges, assign the weights 4, 5, 5, 6, 7, 7, 8 and the additional 3 to each.
PYTHON CODE:
OUTPUT:
PYTHON CODE:
Output:
PROGRAM NO.: 36
Employ the script to obtain a minimum cost spanning tree for the given connected
graph starting from the vertex h.
a
6 2
5 1
b o
3 6
2
7 3
1
c g 2 l
5
4 2
2 3 h 5
k
d 4 i 3 j
PYTHON CODE:
Output:
DATE:
04/10/2024 Tree Traversal Technique
Produce a Python program for inorder, postorder tripleorder traversal technique.
Employ import statement to insert modules from the object-oriented representation
PROGRAM binary search tree program which you created. If the input is 60, 40, 30, 90, 70, 80, 10,
NO.:37
4, 30, 29, 111, 95, 85, what would be the output.
PYTHON CODE:
Output: