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

69 total results found

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...

5. Simple Sorting Algorithms

Alprog - Elektro KKI Module 7: Searching & Sorting

5.1 Bubble Sort Concept Bubble Sort repeatedly steps through the list, compares adjacent elements, and swaps them if they're in the wrong order. How it works: Compare adjacent elements Swap if in wrong order Repeat for all elements After each pass, largest el...

6. Efficient Sorting Algorithms

Alprog - Elektro KKI Module 7: Searching & Sorting

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

Alprog - Elektro KKI Module 7: Searching & Sorting

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

Alprog - Elektro KKI Module 7: Searching & Sorting

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 ...

3. Classes and Objects

Alprog - Elektro KKI Module 8 : OOP (SOLID, Encapsulation, A...

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

Alprog - Elektro KKI Module 8 : OOP (SOLID, Encapsulation, A...

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

Alprog - Elektro KKI Module 8 : OOP (SOLID, Encapsulation, A...

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 ...