Friday, June 28, 2024

Krushkal algorithm

 //Program of krushkal algorithm


#include <stdio.h>

#include <stdlib.h>


#define V 5 // Number of vertices

#define E 6 // Number of edges


// Structure to represent a graph edge

typedef struct Edge {

  int u, v, weight;

} Edge;


// Structure to represent a disjoint set

typedef struct DisjointSet {

  int parent[V];

} DisjointSet;


// Function to create a disjoint set

DisjointSet* createDisjointSet() {

  DisjointSet* ds = (DisjointSet*) malloc(sizeof(DisjointSet));

  for (int i = 0; i < V; i++) {

    ds->parent[i] = i;

  }

  return ds;

}


// Function to find the parent of a vertex

int find(DisjointSet* ds, int i) {

  if (ds->parent[i] == i) return i;

  return find(ds, ds->parent[i]);

}


// Function to merge two sets

void union1(DisjointSet* ds, int x, int y) {

  int xroot = find(ds, x);

  int yroot = find(ds, y);

  ds->parent[xroot] = yroot;

}


// Function to implement Kruskal's algorithm

void kruskal(Edge* edges, int numEdges) {

  DisjointSet* ds = createDisjointSet();

  Edge* result = (Edge*) malloc(sizeof(Edge) * (V-1));

  int i, j;

  for (i = 0; i < V-1; i++) {

    int min = -1;

    for (j = 0; j < numEdges; j++) {

      if (find(ds, edges[j].u) != find(ds, edges[j].v)) {

        if (min == -1 || edges[j].weight < edges[min].weight) {

          min = j;

        }

      }

    }

    result[i] = edges[min];

    union1(ds, edges[min].u, edges[min].v);

  }

  printf("Minimum Spanning Tree:\n");

  for (i = 0; i < V-1; i++) {

    printf("%d - %d = %d\n", result[i].u, result[i].v, result[i].weight);

  }

}


int main() {

  Edge edges[] = {

    {0, 1, 2},

    {0, 2, 4},

    {1, 2, 1},

    {1, 3, 3},

    {2, 3, 5},

    {3, 4, 2}

  };

  int numEdges = sizeof(edges) / sizeof(edges[0]);

  kruskal(edges, numEdges);

  return 0;

}


Tuesday, June 4, 2024

HTML program for countdown timer

 <!DOCTYPE HTML>

<html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1">

<style>

p {

  text-align: center;

  font-size: 60px;

  margin-top: 0px;

}

</style>

</head>

<body>


<p id="demo"></p>


<script>

// Set the date we're counting down to

var countDownDate = new Date("Jan 5, 2030 15:37:25").getTime();


// Update the count down every 1 second

var x = setInterval(function() {


  // Get today's date and time

  var now = new Date().getTime();

    

  // Find the distance between now and the count down date

  var distance = countDownDate - now;

    

  // Time calculations for days, hours, minutes and seconds

  var days = Math.floor(distance / (1000 * 60 * 60 * 24));

  var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));

  var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));

  var seconds = Math.floor((distance % (1000 * 60)) / 1000);

    

  // Output the result in an element with id="demo"

  document.getElementById("demo").innerHTML = days + "d " + hours + "h "

  + minutes + "m " + seconds + "s ";

    

  // If the count down is over, write some text 

  if (distance < 0) {

    clearInterval(x);

    document.getElementById("demo").innerHTML = "EXPIRED"

;

  }

}, 1000);

</script>


</body>

</html>

Sunday, April 7, 2024

ಹವಾಮಾನ

 ಬಿಸಿಲಿನ ಧಗೆಯಿಂದ ಕಂಗೆಟ್ಟ ಜನಕ್ಕೆ ಸಿಹಿ ಸುದ್ದಿ ನೀಡಿದ ಹವಾಮಾನ ಇಲಾಖೆ!


ಬೆಂಗಳೂರು: ಕರ್ನಾಟಕದಲ್ಲಿ ಭಾರೀ ಬಿಸಿಲ ಧಗೆಗೆ ಜನ ಕಂಗೆಟ್ಟಿದ್ದಾರೆ. ಕೂಲಿ ಕಾರ್ಮಿಕರ ಸ್ಥಿತಿಯಂತೂ ಹೇಳತೀರದು. ಬಿಸಿಲಿನ ತೀವ್ರತೆ ನೋಡಿದರೆ ಮೈಯನ್ನು ಸುಡುವಷ್ಟು ತೀವ್ರವಾಗಿದೆ. ಒಮ್ಮೆ ಮಳೆ ಬಂದರೆ ಸಾಕು ಅನ್ನುವಂತೆ ಜನ ಕಾಯುತ್ತಿದ್ದಾರೆ. ಈ ನಡುವೆ ಹವಾಮಾನ ಇಲಾಖೆ ಜನರಿಗೆ ಸಂತಸದ ಸುದ್ದಿ ನೀಡಿದೆ.

ಹೌದು… ಇಂದಿನಿಂದ ರಾಜ್ಯದ 14 ಜಿಲ್ಲೆಗಳಲ್ಲಿ ಅಧಿಕ ಮಳೆಯಾಗಲಿದೆ ಎಂದು ಹವಾಮಾನ ಇಲಾಖೆ ಮುನ್ಸೂಚನೆ ನೀಡಿದೆ.

ಬಾಗಲಕೋಟೆ, ಬೀದರ್, ಗದಗ, ಹಾವೇರಿ, ಕಲಬುರಗಿ, ಕೊಪ್ಪಳ, ರಾಯಚೂರು, ವಿಜಯಪುರ, ಯಾದಗಿರಿ, ಬಳ್ಳಾರಿ, ಚಿತ್ರದುರ್ಗ, ದಾವಣಗೆರೆ, ತುಮಕೂರು, ವಿಜಯನಗರಕ್ಕೆ ಯೆಲ್ಲೋ ಅಲರ್ಟ್ ಘೋಷಿಸಲಾಗಿದೆ.

ಏಪ್ರಿಲ್ 9 ರಂದು ದಕ್ಷಿಣ ಕನ್ನಡ, ಬೀದರ್, ಕಲಬುರಗಿ, ಕೊಪ್ಪಳ, ರಾಯಚೂರು, ವಿಜಯಪುರ, ಯಾದಗಿರಿ, ಬಳ್ಳಾರಿ, ಬೆಂಗಳೂರು ನಗರ, ಬೆಂಗಳೂರು ಗ್ರಾಮಾಂತರ, ಚಾಮರಾಜನಗರ, ಚಿಕ್ಕಬಳ್ಳಾಪುರ, ಚಿತ್ರದುರ್ಗ, ಚಿಕ್ಕಮಗಳೂರು, ಕೊಡಗು, ಕೋಲಾರ, ಮಂಡ್ಯ, ಮೈಸೂರು, ತುಮಕೂರು, ವಿಜಯನಗರದಲ್ಲಿ ಹಗುರ ಮಳೆಯಾಗಲಿದೆ.

ಮುಂದಿನ 2 ದಿನಗಳಲ್ಲಿ ದಕ್ಷಿಣ ಕನ್ನಡ, ಉಡುಪಿ ಹಾಗೂ ಉತ್ತರ ಕನ್ನಡ ಜಿಲ್ಲೆಗಳಲ್ಲಿ ಬಿಸಿ ಮತ್ತಷ್ಟು ಹೆಚ್ಚಾಗಲಿದೆ. ಬೀದರ್, ಬಾಗಲಕೋಟೆ, ಗದಗ, ಕಲಬುರಗಿ, ಕೊಪ್ಪಳ, ರಾಯಚೂರು, ಯಾದಗಿರಿ, ವಿಜಯಪುರ, ಹಾವೇರಿ, ವಿಜಯನಗರ, ಚಿತ್ರದುರ್ಗ, ದಾವಣಗೆರೆ ಮತ್ತು ತುಮಕೂರು ಜಿಲ್ಲೆಗಳಲ್ಲಿ ಉಷ್ಣ ಅಲೆ ಬೀಸಲಿದೆ.

ಬೆಂಗಳೂರಿನಲ್ಲಿ ಮೋಡಕವಿದ ವಾತಾವರಣವಿರಲಿದೆ, ಎಚ್ಎಎಲ್ನಲ್ಲಿ 37.0 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಗರಿಷ್ಠ ಉಷ್ಣಾಂಶ, 23.0 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಕನಿಷ್ಠ ಉಷ್ಣಾಂಶ, ನಗರದಲ್ಲಿ 37.0 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಗರಿಷ್ಠ ಉಷ್ಣಾಂಶ, 23.6 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಕನಿಷ್ಠ ಉಷ್ಣಾಂಶ, ಕೆಐಎಎಲ್ನಲ್ಲಿ 38.3 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಗರಿಷ್ಠ ಉಷ್ಣಾಂಶ, 22.5 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಕನಿಷ್ಠ ಉಷ್ಣಾಂಶ, ಜಿಕೆವಿಕೆಯಲ್ಲಿ 36.8 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಗರಿಷ್ಠ ಉಷ್ಣಾಂಶ, 20.0 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಕನಿಷ್ಠ ಉಷ್ಣಾಂಶ ದಾಖಲಾಗಿದೆ.

ಹೊನ್ನಾವರದಲ್ಲಿ 33.3 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಗರಿಷ್ಠ ಉಷ್ಣಾಂಶ, 24.2 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಕನಿಷ್ಠ ಉಷ್ಣಾಂಶ, ಕಾರವಾರದಲ್ಲಿ 36.1 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಗರಿಷ್ಠ ಉಷ್ಣಾಂಶ, 25.7 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಕನಿಷ್ಠ ಉಷ್ಣಾಂಶ, ಬೀದರ್ನಲ್ಲಿ 39.4ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಗರಿಷ್ಠ ಉಷ್ಣಾಂಶ, 26.2 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಕನಿಷ್ಠ ಉಷ್ಣಾಂಶ, ಧಾರವಾಡದಲ್ಲಿ 39.8 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಗರಿಷ್ಠ ಉಷ್ಣಾಂಶ, 22.2 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಕನಿಷ್ಠ ಉಷ್ಣಾಂಶ, ಹಾವೇರಿಯಲ್ಲಿ 39.8 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಗರಿಷ್ಠ ಉಷ್ಣಾಂಶ, 22.6 ಡಿಗ್ರಿ ಸೆಲ್ಸಿಯಸ್ ಕನಿಷ್ಠ ಉಷ್ಣಾಂಶ ದಾಖಲಾಗಿದೆ.

Friday, March 29, 2024

Metro

Bengaluru-Tumkur Namma Metro Project: 19 Elevated Stations Proposed For 52.41 km Line

Updated: Thursday, March 28, 2024, 21:06 [IST]

The Bengaluru-Tumkur Namma Metro project is set to transform the region's transportation infrastructure, with plans for 19 elevated stations along the proposed 52.41 km line, according to reports.

The metro line, starting from Madavara (BIEC) station and extending to Tumkur Bus Stand, aims to enhance connectivity and ease commuting for residents.

The 19 elevated stations will be strategically located to serve key areas and facilitate seamless travel within Tumkur. The Namma metro line's estimated length of 52.41km is expected to significantly reduce travel time and traffic congestion, providing a more efficient mode of transportation for commuters.

The Tumkur Metro project holds promise for boosting economic development and enhancing the quality of life for residents. The efficient metro system is expected to attract investment, improve accessibility to various parts of the city, and reduce pollution levels.



Authorities are working diligently to finalize plans and secure necessary approvals for the Tumkur Metro project. Once operational, the metro line is expected to transform the city's transportation landscape, offering a modern and sustainable mode of travel for residents and visitors alike.

Earlier, Karnataka's Home Minister, G. Parameshwara, had revealed plans for the Bengaluru-Tumkur metro project to be developed in partnership with the private sector. The extension of Namma Metro's Green Line from Nagasandra to Madavara (formerly Bangalore International Exhibition Centre or BIEC) on Tumkur Road is scheduled to commence operations by July 2024.

Speaking at a press conference after attending the Republic Day program, Parameshwara stressed the importance of enhancing Bengaluru's communication system to alleviate pressure on the city. The metro extension to Tumkur is part of this plan, with a detailed project report (DPR) currently being prepared.

Parameshwara clarified that the government will not bear the expenses for the metro rail lines' construction; approval from the central and state governments is sufficient. Several companies have shown interest in investing in the project, which will be executed in collaboration with the private sector.

A total of Rs 697 crore has been allocated for various city projects, including the construction of the bus stand, the inauguration of a new university campus, and various development endeavors. Chief Minister Siddaramaiah is set to inaugurate these projects on the 29th.

While the smart city project is limited to only six wards, Parameshwara emphasized the need to extend development efforts to all wards. A request for Rs 500 crore from the Chief Minister will be made for the construction of 'Greater Tumkur.' Additionally, Parameshwara highlighted the need for further development of the university's new campus and the request for additional funds.

Under the Narega scheme, Rs 85 crore has been allocated for the development of one thousand schools in the district. Repair work, construction of enclosure walls, and playground development are in progress, with most tasks already completed. The district has achieved the top position in implementing the Narega scheme, generating 55 lakh man-days in the last seven months. Parameshwara emphasized that projects worth Rs 450 crore have been successfully executed.


Thursday, March 7, 2024

Java program Display vehicle details using abstract class


 Program :-


class HelloWorld {

    public static void main(String[] args) {

         Bike tvs=new Bike("TVS Sports","Green",2,"Not working") ;

  tvs.disBikeDetails(); 

}

}

abstract class Vehicle

{

    String name;

    String colour;

    int wheels;

    String condition;

    abstract void disBikeDetails();

}

class Bike extends Vehicle

{

    Bike(String n, String c,int w, String co)

    {

        name=n;

        colour=c;

        wheels=w;

        condition=co;

          }

    void disBikeDetails()

    {

        System.out.println("Bike name :- "+name);

        System.out.println("color :- "+colour);

        System.out.println("Number of wheels :- "+wheels);

        System.out.println("Condition :-"+condition);

    }

}

 OUTPUT  :-







Friday, February 9, 2024

Java program for Star pattern

 public class Main {

  public static void main(String[] args) {

    System.out.println("java program to print * pattern showing right direction");

    int i,j;

    for(i=0;i<4;i++)

    {

    for(j=0;j<=i;j++)

    {

    System.out.print("*");}

    System.out.println("");}

    for(i=3;i<4;i--)

    {

    for(j=0;j<=i-1;j++)

    {

    System.out.print("*");}

    System.out.println("");}

  }

 }








  Blog chatgpt Blog