FUNCTIONS Functions are like reusing code that you have written rather writing everything from scratch. For example like in CPP //header file #include<iostream> using namespace std; // main program int main(){ //this will display hello world cout<<"hello world"; return 0; } now with function #include<iostream> using namespace std; //funtion declaration void Hello_World(){} int main(){ //calling funtion Hellow_World(); return 0; } //defining funtion void Hello_World(){ cout<<"hello world"; } here funtion can be divided in 3 parts Declaration: means to tell it's name and it's arguments and with their type. Defination:means to tell what will be inside of it and what will it do. Calling: means to call that function using it's name or provoking it. So by this we are calling the function to print hello world rather writing the code from scratch. For more you can watch below link of YoutTube video : Functions
Why Companies Use Linux: 1. Open Source Freedom Companies can access and modify the source code without licensing restrictions. No vendor lock-in, meaning more control over systems and infrastructure. 2. Security and Stability Linux is less vulnerable to malware and cyberattacks. It can run for years without crashing—ideal for servers and networks. 3. Cost-Efficiency Most Linux distributions are free. Saves thousands in licensing costs compared to Windows or macOS. 4. Scalability and Performance Works efficiently across systems: from embedded devices to massive cloud data centers. Can be fine-tuned for speed and performance. 5. Development-Friendly Rich support for programming languages, tools (Git, Docker, Kubernetes), and automation. Perfect for building and deploying software quickly and reliably. 6. Cloud & Server Dominance Nearly all cloud providers (AWS, Azure, Google Cloud) run Linux-based servers. Powers most web hosting services and critical infrastructure worldwide. ...
What Is Kruskal’s Algorithm? Kruskal’s Algorithm is a greedy algorithm used to find the Minimum Spanning Tree (MST) of a connected, undirected, weighted graph. It builds the MST by selecting the smallest-weight edges first, ensuring no cycles are formed. Why Use Kruskal’s Algorithm? It guarantees the least total edge weight to connect all vertices. Especially useful when the graph has sparse connections or edges are already sorted. It’s simple and efficient for edge-centric problems. Where to Use Kruskal’s Algorithm? Network Design : Laying out cables or pipelines with minimal cost. Road Systems : Connecting cities with shortest total distance. Clustering Algorithms : In machine learning, for hierarchical clustering. Electrical Grids : Designing efficient power distribution networks. Key Steps in Kruskal’s Algorithm Sort all edges by weight (ascending). Initialize MST as an empty set. Iterate through edges : Add edge if it doesn’t form a cycle (using Union-Fin...
Comments
Post a Comment