Advanced Search
Search Results
297 total results found
6. Efficient Sorting Algorithms
6.1 Merge Sort Concept Merge Sort is a divide-and-conquer algorithm that divides the array into halves, recursively sorts them, and then merges the sorted halves. Divide and Conquer Strategy: Divide: Split array into two halves Conquer: Recursively sort each ...
7. Comparison of Sorting Algorithms
7.1 Performance Summary // Test all sorting algorithms #include <time.h> void testSortingAlgorithms() { int sizes[] = {100, 1000, 10000}; for (int s = 0; s < 3; s++) { int n = sizes[s]; printf("\n=== Array Size: %d ===\n", n); ...
8. Practical Applications
8.1 Search and Sort Combined #include <stdio.h> #include <stdlib.h> #include <string.h> // Student structure typedef struct { int id; char name[50]; float gpa; } Student; // Compare functions for sorting int compareByID(const void *a, const void ...
1. Main Concept of Hash Map
Hashing is the process of converting data of any size (like a string, number, or object) into a fixed-length integer value. This integer value is called a "hash value," "hash code," or simply "hash." The primary data structure that uses this concept is called ...
2. Collision Handling
A Collision occurs when two or more different keys produce the same hash value (index). For example, "Budi" and "Dina" are both hashed to row #5. We can't overwrite Budi's data. We must have a strategy to handle this. 2.1. Separate Chaining This is the most c...
3. Load Factor and Rehashing
3.1. Load Factor (λ) The Load Factor (λ) is a measure of how full the hash table is. It is a critical metric for performance. Formula: λ = m/n n = total number of items stored in the table. m = total size of the hash table (number of buckets). Impact on Pe...
4. Example: Full Manual Implementation
This chapter combines all the concepts from Chapters 2 and 3 into a single, complete MyHashMap class. This class handles insertion, searching, deletion, and automatic rehashing. 4.1. Manual Implementation Using Separate Chaining #include <iostream> #include <s...
5. Hashing Implementation with C++ STL
In C++, instead of creating a Hash Table manually, you could use Standard Template Library (STL). The STL implementation automatically handles hash functions, collisions, and rehashing when the load factor gets too high. 5.1. std::unordered_map (Key-Value) std...
6. Custom Struct Keys
A notable limitation of the C++ STL's std::unordered_map and std::unordered_set is their inability to natively support user-defined types (such as a struct or class) as keys. An attempt to instantiate a map with a custom struct, as shown below, will result in ...
9.1 Learning Objectives
Understand Blynk as a cloud-dependent IoT platform for mobile control and monitoring Implement basic control using Blynk's virtual pin system for LED switching Understand Node-RED as a flow-based visual programming tool for IoT integration Create basic...
9.3 Blynk Tutorial
Setup Blynk Go to Blynk Official Website Sign Up for a new account and login Once you get redirected to Blynk Console, go to Developer Zone > My Templates and click the "New Template Button" Give the project name and description (optional) After ...
9.5 Node Red Tutorial
Node Red Setup In this tutorial, I am using a Linux terminal in Windows (WSL) for simplicity, if you're using other environment, that is fine too but some steps might be a little bit different, so be ready to adapt. Install Node and NPM sudo apt update s...
3. Classes and Objects
3.1 Understanding Classes and Objects Definition: Class: A blueprint or template for creating objects (like a cookie cutter) Object: An instance of a class (like a cookie made from the cutter) Real-World Example: Class: Student (blueprint) - Attributes: ...
4. Encapsulation
4.1 What is Encapsulation? Encapsulation is the bundling of data (attributes) and methods that operate on that data within a single unit (class), while restricting direct access to some of the object's components. Purpose: Data Hiding: Protect internal state ...
5. Abstraction
5.1 What is Abstraction? Abstraction is the concept of hiding complex implementation details and showing only the essential features of an object. It focuses on what an object does rather than how it does it. Real-World Analogy: When you drive a car, you use ...
6. SOLID Principles
6.1 Introduction to SOLID SOLID is an acronym for five design principles that make software designs more understandable, flexible, and maintainable. Letter Principle Core Idea S Single Responsibility A class should have one reason to change O Open/Clo...
7. Constructors and Destructors
7.1 Constructors Purpose: Special member function that initializes an object when it's created. Types of Constructors: #include <iostream> #include <string> using namespace std; class Student { private: string name; int id; float gpa; public:...
9.2 Blynk
Introduction to Blynk Blynk is an IoT platform designed to facilitate remote monitoring and control of microcontroller-based projects through mobile applications. The platform operates on a client-server architecture where hardware devices communicate with a c...
9.4 Node Red
Introduction to Node-RED Node-RED is a flow-based programming tool built on Node.js that enables visual development of IoT applications and automation systems. Originally created by IBM for wiring together hardware devices, APIs, and online services, it provid...
1. Graphs Concept
A Graph is a non-linear data structure consisting of nodes and edges. The nodes are formally called vertices, and the edges are lines or arcs that connect any two nodes in the graph. Graphs are used to solve many real-world problems. They are used to represen...