Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

70 total results found

1. Introduction to User-Defined Data Types

Alprog - Elektro KKI Module 5 : Data Types (Struct, Enum, Ty...

1.1 Why User-Defined Types? In previous modules, we learned about basic data types like int, float, char, etc. These are sufficient for simple programs, but real-world applications often require more complex data structures. Example Problem: Suppose you want t...

2. Structures (struct)

Alprog - Elektro KKI Module 5 : Data Types (Struct, Enum, Ty...

2.1 What is a Structure? A structure is a user-defined data type that groups variables of different types under a single name. Think of it as creating your own custom data type. Python vs C Comparison: Python C Uses classes or dictionaries Uses struct ...

3. Enumerations (enum)

Alprog - Elektro KKI Module 5 : Data Types (Struct, Enum, Ty...

3.1 What is an Enumeration? An enumeration is a user-defined data type consisting of a set of named integer constants. Enums make code more readable by replacing "magic numbers" with meaningful names. Python vs C Comparison: Python C No built-in enum (u...

4. Type Definitions (typedef)

Alprog - Elektro KKI Module 5 : Data Types (Struct, Enum, Ty...

4.1 What is typedef? typedef creates aliases (alternative names) for existing data types. It makes code more readable and easier to maintain. Basic Syntax: typedef existing_type new_name; 4.2 typedef with Basic Types // Create aliases for basic types typedef ...

5. File Input/Output

Alprog - Elektro KKI Module 5 : Data Types (Struct, Enum, Ty...

5.1 Why File I/O? So far, all our programs lose their data when they terminate. File I/O allows programs to: Save data permanently Read data from external sources Create logs and reports Share data between programs Python vs C File Operations: Python C ...

1. Introduction to Linked Lists

Alprog - Elektro KKI Module 6 : Linked List

1.1 What is a Linked List? A linked list is a linear data structure where elements are not stored in contiguous memory locations. Instead, each element (called a node) contains: Data: The actual value stored Pointer(s): Reference to the next (and possibly pre...

2. Node Structure

Alprog - Elektro KKI Module 6 : Linked List

2.1 Defining a Node In C, a node is typically defined using a structure: // Definition of a node struct Node { int data; // Data part struct Node *next; // Pointer to next node }; Memory Layout: Single Node in Memory: ┌──────────┬──────────...

3. Singly Linked List Operations

Alprog - Elektro KKI Module 6 : Linked List

3.1 Creating an Empty List #include <stdio.h> #include <stdlib.h> struct Node { int data; struct Node *next; }; // Initialize head pointer struct Node *head = NULL; 3.2 Insertion Operations 3.2.1 Insert at Beginning void insertAtBeginning(struct Nod...

4. Complete Singly Linked List Example

Alprog - Elektro KKI Module 6 : Linked List

#include <stdio.h> #include <stdlib.h> // Node structure struct Node { int data; struct Node *next; }; // Function prototypes void insertAtBeginning(struct Node **head, int value); void insertAtEnd(struct Node **head, int value); void insertAtPositio...

5. Doubly Linked List

Alprog - Elektro KKI Module 6 : Linked List

5.1 Node Structure struct DNode { int data; struct DNode *prev; // Pointer to previous node struct DNode *next; // Pointer to next node }; Visual Representation: NULL ← [prev|10|next] ⇄ [prev|20|next] ⇄ [prev|30|next] → NULL ↑ HEA...

6. Circular Linked List

Alprog - Elektro KKI Module 6 : Linked List

6.1 Structure In a circular linked list, the last node points back to the first node (or head). struct Node { int data; struct Node *next; }; Visual Representation: ┌───────────────────────────┐ ↓ │ HEAD → [10|●] ...

7. Advanced Linked List Operations

Alprog - Elektro KKI Module 6 : Linked List

7.1 Reverse a Singly Linked List Method 1: Iterative void reverseList(struct Node **head) { struct Node *prev = NULL; struct Node *current = *head; struct Node *next = NULL; while (current != NULL) { // Store next next = cu...

8. Practical Applications

Alprog - Elektro KKI Module 6 : Linked List

8.1 Polynomial Addition #include <stdio.h> #include <stdlib.h> // Node for polynomial term struct PolyNode { int coeff; // Coefficient int exp; // Exponent struct PolyNode *next; }; // Insert term in descending order of exponent void insertTe...

9. Common Errors and Debugging

Alprog - Elektro KKI Module 6 : Linked List

9.1 Memory Leaks Problem: void createList() { struct Node *head = (struct Node*)malloc(sizeof(struct Node)); head->data = 10; head->next = NULL; // MEMORY LEAK! head is lost when function returns } Solution: struct Node* createList() { str...

1. Introduction to Searching

Alprog - Elektro KKI Module 7: Searching & Sorting

1.1 What is Searching? Searching is the process of finding a particular element or checking if an element exists in a data structure (array, linked list, tree, etc.). Real-World Analogies: Finding a book in a library Searching for a contact in your phone Look...

2. Linear Search

Alprog - Elektro KKI Module 7: Searching & Sorting

2.1 Concept Linear Search (also called Sequential Search) checks every element in the array sequentially until the target is found or the end is reached. How it works: Start from the first element Compare each element with the target If match found, return th...

3. Binary Search

Alprog - Elektro KKI Module 7: Searching & Sorting

3.1 Concept Binary Search is a fast search algorithm that works on sorted arrays by repeatedly dividing the search interval in half. Prerequisites: Array must be sorted Random access to elements (arrays work well) How it works: Compare target with middle el...

4. Introduction to Sorting

Alprog - Elektro KKI Module 7: Searching & Sorting

4.1 What is Sorting? Sorting is the process of arranging elements in a specific order (ascending or descending). Why Sort? Faster Searching: Enables binary search Data Organization: Makes data easier to understand Algorithm Requirements: Many algorithms requi...