Project File Structure (VS2022) ContactBook.h and ContactBook.c: Header and implemantation files for core contact book logic LinkedList.h and LinkedList.c: Header and implementation files for the singly linked list data structuer app.c: Test application to interact with the contact book via a menu i...
A heap is a complete binary tree structure typically implemented using a dynamic array. This implementation focuses on a min-heap, where the root node holds the smallest value and each parent node is less than or equal to its children. Data Structure and Function Prototypes #ifndef HEAP_H #define HE...
Task 1 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #define SIZE 4 #define ROWS 2 void demo1() { int arr[SIZE] = {1, 9, 8, 4}; int i; // Output memory size of array arr printf("sizeof(arr) = %zu\n", sizeof(arr)); // Output address and value of each element for (i = 0; i < SI...
Fundamental Pointer Operations and Memory Addressing Pointers store memory addresses, allowing indirect access and modification of variables. The following implementation demonstrates pointer initialization, address assignment, dereferencing, and hexadecimal address printing. #include <stdio.h>...
Static Stack 1.1 Definition A static stack is a fixed-capacity stack data structure where the size is determined at creation time and cannot be modified during runtime. This implementation relies on a pre-allocated array to hold elements, and since memory is reserved during compilation, there's a p...
Array Fundamentals An array is a collection of elements of the same type stored in contiguous memory locations. One-Dimensional Array Declaration // General syntax for array declaration element_type array_name[array_size]; The declaration requires three components: element_type: the data type of eac...
Computer Systems and Programming LanguagesA computer system integrates hardware and software to perform complex calculations and logical operations. Hardware components include the Central Processing Unit (CPU), memory, and input/output devices, often based on the Von Neumann architecture where inst...
A common interview problem involves counting the number of 1 bits (set bits) in the binary representation of an integer. The key insight lies in understanding how computers store signed integers using two's complement notation. The expression n &= (n - 1) is a powerful optimization that eliminat...
LinkedList Header Definition The underlying data structure is a singly linked list. We define the node structure to hold generic data, which will be specialized for the contact information later. #ifndef LINKED_LIST_H #define LINKED_LIST_H #include <stdlib.h> #include <assert.h> #include...
1D and 2D Integer Array Memory Layout Analysis #include <stdio.h> #define ROWS 2 #define COLS 4 void analyze_single_dim() { int values[COLS] = {1, 9, 8, 4}; int idx; printf("Total size of values: %lu bytes\n", sizeof(values)); for (idx = 0; idx < COLS; idx++) printf("Address...