Ayu-hack / Hacktoberfest2024-1

This is repo to create some pull requests and completing hacktoberfest 2024 easily. All request will be accepted. Genuine Pull Request will promoted also. #hacktobefest #hacktobefest2024 #hacktobefest-accepted Resources
46 stars 467 forks source link

Implementation of Stack using Array , Dynamic array & Linked List #100

Closed kishan-25 closed 1 month ago

kishan-25 commented 1 month ago

Description:

This task aims to implement three fundamental data structures—Static Array, Dynamic Array, and Linked List—in C++ to demonstrate how each manages memory and performs in different scenarios.

1. Static Array: A fixed-size array where elements are stored in contiguous memory locations. Operations to implement: Insertion: Add elements at a specific index (if space allows). Deletion: Remove elements from a given index. Traversal: Iterate over the array to access elements. Search: Find an element in the array using linear search. Constraints: Memory is allocated at the time of declaration, and the size cannot be changed during runtime. 2. Dynamic Array: A resizable array that expands (or shrinks) dynamically when the current capacity is exceeded. Operations to implement: Insertion: Add elements and automatically resize the array when full (typically by doubling the size). Deletion: Remove elements and resize when needed to optimize memory usage. Resizing: Dynamically manage memory allocation and ensure minimal unused space. Traversal: Efficiently access elements through index-based iteration. Benefits: More memory-efficient than a static array when dealing with unknown or changing data sizes. 3. Linked List: A linear data structure where each element (node) points to the next node in the sequence. Operations to implement: Node Insertion: At the head (beginning of the list). At the tail (end of the list). At a specific position in the list. Node Deletion: Remove nodes from the head, tail, or specific positions. Traversal: Iterate over the list by following node pointers. Search: Locate a node containing a specific value. Advantages: Efficient for dynamic memory management, especially when frequent insertions and deletions are needed. Purpose: To understand the differences in memory management and performance between static and dynamic data structures. Compare the efficiency of accessing, inserting, and deleting elements across the three implementations.

Ayu-hack commented 1 month ago

Please share the screenshot of working in PR. Assigned. More repos are available for pull requests, and they’re part of Hacktoberfest 2024. Feel free to tag me in your Hacktoberfest certificate or badges LinkedIn post! 😄

👉 Follow my GitHub and connect with me on LinkedIn! ⭐ Star these repos to stay updated for next year’s Hacktoberfest!