Monday, July 24, 2023

The divide-and-conquer approach

 The divide-and-conquer approach

The divide-and-conquer paradigm involves three steps at each level of the recursion:

Divide the problem into a number of subproblems that are smaller instances of the

same problem.

Conquer the subproblems by solving them recursively. If the subproblem sizes are

small enough, however, just solve the subproblems in a straightforward manner.

Combine the solutions to the subproblems into the solution for the original problem.

EXAMPLE

The merge sort algorithm closely follows the divide-and-conquer paradigm. Intuitively, it operates as follows.

Divide: Divide the n-element sequence to be sorted into two subsequences of n=2

elements each.

Conquer: Sort the two subsequences recursively using merge sort.

Combine: Merge the two sorted subsequences to produce the sorted answer.

Sunday, July 23, 2023

ISCE- LIST OF PROGRAMS

1 Magic number CLICK
2 Happy number CLICK
3 Fibonacci series CLICK
4 Check twin prime from a series CLICK
5 Armstrong number CLICK
6 Automorphic number CLICK
7 decimal to binary conversion CLICK
8 a+a/2! +a/3! +a/4! +.... n th term
9 neon number in java CLICK
10 KaprekarNumbers CLICK
11 Fascinating Number CLICK
12 square Matrix CLICK
13 string having repeating characters CLICK
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
PATTERN * * * * * * * * * * *

ISCE

 THEORY

APC BOOK

PRACTICAL


PROJECT


SAMPLE COPY



UNION MAKE SET FIND SET


 













void make_set(int v) {
    parent[v] = v;
}

int find_set(int v) {
    if (v == parent[v])
        return v;
    return find_set(parent[v]);
}

void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b)
        parent[b] = a;
}











There are two ways to improve it: 
1. Path Compression
2. Union by Rank










DAA

 The divide-and-conquer approach

DEFINITION-LINK

merge sort--LINK


SORT:

merge sort--LINK


GRAPH:

UNION MAKE SET FIND SET---LINK

PRIMS--

KRUSKAL--

DYSTRAS--

DFS--

BFS--

FLOYD--

WARSHALL--

WRAPPER CLASS

 Wrapper Classes-INTRODUCTION  CLICK

WRAPPER CLASS-AUTOBOX UNBOX  CLICK

WRAPPER CLASS-INTEGER  CLICK

WRAPPER CLASS-CHARACTER  CLICK

ARTIFICIAL INTELLIGENCE

 THOERY ---LINK

PRACTICAL---

CHAPTER WISE QUESTION----

ASSIGNMENT----

CBCS SYLLABUS-----

FOL PRACTISE--LINK