{"id":20256537,"url":"https://github.com/rohitpawar001/structures-and-algorithms","last_synced_at":"2025-07-05T04:33:22.045Z","repository":{"id":247977062,"uuid":"827393911","full_name":"RohitPawar001/Structures-and-Algorithms","owner":"RohitPawar001","description":"This repository containns all the builtin data structures and derived data structure, and various algorithms of searching and sorting in python.","archived":false,"fork":false,"pushed_at":"2024-11-13T04:23:03.000Z","size":48,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T03:43:43.166Z","etag":null,"topics":["dsa","dsa-algorithm","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RohitPawar001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-11T15:12:49.000Z","updated_at":"2024-11-13T04:23:06.000Z","dependencies_parsed_at":"2024-07-28T16:26:35.080Z","dependency_job_id":"49ed35b8-898c-43c4-8cd9-3cae5201a3d0","html_url":"https://github.com/RohitPawar001/Structures-and-Algorithms","commit_stats":null,"previous_names":["rohitpawar001/structures-and-algorithms"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RohitPawar001%2FStructures-and-Algorithms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RohitPawar001%2FStructures-and-Algorithms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RohitPawar001%2FStructures-and-Algorithms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RohitPawar001%2FStructures-and-Algorithms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RohitPawar001","download_url":"https://codeload.github.com/RohitPawar001/Structures-and-Algorithms/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241715024,"owners_count":20007913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dsa","dsa-algorithm","python"],"created_at":"2024-11-14T10:47:10.682Z","updated_at":"2025-03-03T17:55:59.109Z","avatar_url":"https://github.com/RohitPawar001.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Structures and Algorithms in python\n\n\u003ch1\u003e 1.list \u003c/h1\u003e\n    Lists are ordered collections of data, It allows different types of elements in the list. The costly operation is inserting or deleting the element from the beginning of the List as all the elements are needed to be shifted. \n    \u003cimg src=\"https://github.com/user-attachments/assets/974869e3-a0ef-4762-8f4e-dab63c52af9b\"\u003e\n\n\u003ch1\u003e2. tuple \u003c/h1\u003e\n    tuple are same as list except they are immutable. immutable means once the tuple is created cannot add or remove elements from the tuple \u003cbr\u003e to remove the element from the tuple we have to first typecast it into the another datatype.\n    \u003cbr\u003e\n    tuple are enclosed within the () braces and elements are seperated by commas and it can store different datatypes \n\n\u003ch1\u003e3. sets \u003c/h3\u003e\n     \nSets are unordered collections of unique elements. In Python, you can create sets using curly braces {} or the set() constructor.\n(~ # Create sets\nset_a = {1, 2, 3}\nset_b = {3, 4, 5}\n\n**Union**\nunion_result = set_a | set_b\nprint(\"Union:\", union_result)\n\n**Intersection**\nintersection_result = set_a \u0026 set_b\nprint(\"Intersection:\", intersection_result)\n\n**Difference**\ndifference_result = set_a - set_b\nprint(\"Difference:\", difference_result)\n\n**Membership testing**\nprint(2 in set_a)  # True\nprint(6 in set_a)  # False\n~)\n\n\u003ch1\u003e4.Stack\u003c/h1\u003e\nstack follows LIFO (last in last out ) priciple ie the lastly inserted elemetn is get removed first.\n\u003cbr\u003e in python the stack can be implemented using list.\n\u003cbr\u003e \u003cimg src = \"https://github.com/user-attachments/assets/87984e52-035b-4af7-8069-6a4dc84d7d64\" !\u003e\n\u003cbr\u003e the element insertation and deletion done at the same end.\n\u003cbr\u003e we can perform two operation in stack ther are \u003cbr\u003e 1.push \u003cbr\u003e 2.pop\n\n\u003ch1\u003e5.Queue\u003c/h1\u003e\nA queue in Python is a linear data structure that follows the First In First Out (FIFO) principle, meaning the first element added to the queue will be the first one to be removed. Think of it like a line of people waiting for a service, where the person who arrives first is served first.\u003cbr\u003e\nThere are several ways to implement a queue in Python:\u003cbr\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/a01ea920-0d54-4963-a25b-1379d10dbe8c\"\u003e\n\n1.using lists\u003cbr\u003e2.using queue.Queue\u003cbr\u003e3.using \n\n\u003ch1\u003ebytearray\u003c/h1\u003e\nA binary array in Python typically refers to an array that contains binary data, which is data represented in the form of 0s and 1s. There are several ways to work with binary arrays in Python, depending on your specific needs. Here are a few common methods:\u003cbr\u003e\n1.using numpy \u003cbr\u003e2.using array module \u003cbr\u003e3.using lists \u003cbr\u003e4.using bytearray\n\n\u003ch1\u003e6.Dictionary\u003c/h1\u003e\n\u003cbr\u003eA dictionary in Python is a collection of key-value pairs. Each key is unique and maps to a specific value. Dictionaries are mutable, meaning you can change, add, or remove items after the dictionary is created. They are also ordered as of Python 3.7, meaning the items have a defined order.\n\u003cbr\u003e\n**Dictionary method**\n\u003cbr\u003e\nHere are some useful dictionary methods:\u003cbr\u003e\n\nkeys(): Returns a view object of all keys.\u003cbr\u003e\nvalues(): Returns a view object of all values.\u003cbr\u003e\nitems(): Returns a view object of all key-value pairs.\u003cbr\u003e\nupdate(): Updates the dictionary with key-value pairs from another dictionary or an iterable of key-value pairs.\n\n\u003ch1\u003e7.Linked List\u003c/h1\u003e\nA linked list is a linear data structure where each element, called a node, contains a data part and a reference (or link) to the next node in the sequence. Linked lists are useful for dynamic memory allocation and efficient insertions and deletions.\u003cbr\u003e\n\n**Types of Linked Lists**\u003cbr\u003e\nSingly Linked List: Each node points to the next node.\u003cbr\u003e\nDoubly Linked List: Each node points to both the next and the previous node.\u003cbr\u003e\nCircular Linked List: The last node points back to the first node.\u003cbr\u003e\n\n**Node Class:** Defines the structure of a node with data and next attributes.\u003cbr\u003e\n**LinkedList Class:** Contains methods to insert nodes at the beginning and end, delete nodes, search for nodes, and print the list.\u003cbr\u003e\n**Example Usage:** Demonstrates how to create a linked list, insert nodes, search for a node, delete a node, and print the list.\u003cbr\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohitpawar001%2Fstructures-and-algorithms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohitpawar001%2Fstructures-and-algorithms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohitpawar001%2Fstructures-and-algorithms/lists"}