{"id":23772990,"url":"https://github.com/vaxastd/Delete-First-and-Last","last_synced_at":"2026-04-02T08:30:17.119Z","repository":{"id":269893289,"uuid":"908779442","full_name":"guanshiyin28/Delete-First-and-Delete-Last-Function","owner":"guanshiyin28","description":"Delete First and Delete Last Function (Python \u0026 C++)","archived":false,"fork":false,"pushed_at":"2025-01-25T19:01:30.000Z","size":26,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-21T05:15:37.280Z","etag":null,"topics":["cpp","delete-first","delete-last","python"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guanshiyin28.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["guanshiyin28"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2024-12-27T00:23:17.000Z","updated_at":"2025-01-25T19:01:33.000Z","dependencies_parsed_at":"2025-01-25T18:32:57.961Z","dependency_job_id":null,"html_url":"https://github.com/guanshiyin28/Delete-First-and-Delete-Last-Function","commit_stats":null,"previous_names":["guanshiyin28/delete-first-and-delete-last-function"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanshiyin28%2FDelete-First-and-Delete-Last-Function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanshiyin28%2FDelete-First-and-Delete-Last-Function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanshiyin28%2FDelete-First-and-Delete-Last-Function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanshiyin28%2FDelete-First-and-Delete-Last-Function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guanshiyin28","download_url":"https://codeload.github.com/guanshiyin28/Delete-First-and-Delete-Last-Function/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239958308,"owners_count":19724926,"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":["cpp","delete-first","delete-last","python"],"created_at":"2025-01-01T05:21:43.795Z","updated_at":"2026-04-02T08:30:17.078Z","avatar_url":"https://github.com/guanshiyin28.png","language":"C++","readme":"# Delete First and Delete Last Function\n\nThis repository aims to provide a comprehensive starting point for understanding and implementing two fundamental list operations: deleting the first element and deleting the last element. These operations are implemented in Python and C++ and serve as a great introduction to list manipulation for beginners and intermediate programmers.\n\n\u003chr\u003e\u003cbr\u003e\n\n## Purpose of This Repository\n\n### Deleting the First Element\n\nDeleting the first element of a list is a basic operation that involves removing the element at the beginning of the list and shifting all subsequent elements one position to the left. This repository provides examples of how to perform this operation efficiently in Python and C++.\n\n### Deleting the Last Element\n\nDeleting the last element of a list is another essential operation that involves removing the element at the end of the list. This operation is straightforward and is commonly used in various programming tasks. This repository includes examples of how to handle this operation in Python and C++.\n\n\u003chr\u003e\u003cbr\u003e\n\n## Demonstration\n\nRefer to the `program.py`, `Delete First.cpp`, and `Delete Last.cpp` files for complete demonstrations of the delete first and delete last functions in Python and C++.\n\n### Python\n\n```python\n# Delete First Function\n\narr = [1, 2, 3, 4, 5]\n\nprint(\"Array before deleted:\", arr)\n\narr.pop(0)\n\nprint(\"\\nArray after deleted:\", arr)\n\n# Delete Last Function\n\narr = [1, 2, 3, 4, 5]\n\nprint(\"Array before deleted:\", arr)\n\narr.pop()\n\nprint(\"\\nArray after deleted:\", arr)\n```\n\n### C++\n\n#### Delete First.cpp\n\n```cpp\n// filepath: /home/guan/Documents/Code/Delete-First-and-Delete-Last-Function/Delete First.cpp\n#include \u003cstdio.h\u003e\n#include \u003cstdlib.h\u003e\n\n// Fungsi untuk menghapus elemen pertama pada array\nvoid deleteFirst(int arr[], int n) {\n    for(int i=0; i\u003cn-1; i++) {\n        arr[i] = arr[i+1];\n    }\n}\n\nint main() {\n    int arr[5] = {1, 2, 3, 4, 5};\n    int n = sizeof(arr)/sizeof(arr[0]);\n\n    printf(\"Array sebelum delete: \");\n    for(int i=0; i\u003cn; i++) {\n        printf(\"%d \", arr[i]);\n    }\n\n    deleteFirst(arr, n);\n\n    printf(\"\\nArray setelah delete: \");\n    for(int i=0; i\u003cn; i++) {\n        printf(\"%d \", arr[i]);\n    }\n\n    return 0;\n}\n```\n\n#### Delete Last.cpp\n\n```cpp\n// filepath: /home/guan/Documents/Code/Delete-First-and-Delete-Last-Function/Delete Last.cpp\n#include \u003cstdio.h\u003e\n#include \u003cstdlib.h\u003e\n\n// Fungsi untuk menghapus elemen terakhir pada array\nvoid deleteLast(int arr[], int n) {\n    if(n == 0) {\n        printf(\"Array kosong\\n\");\n    } else {\n        for(int i=n-1; i\u003e0; i--) {\n            arr[i] = arr[i-1];\n        }\n        arr[0] = 0;\n    }\n}\n\nint main() {\n    int arr[5] = {1, 2, 3, 4, 5};\n    int n = sizeof(arr)/sizeof(arr[0]);\n\n    printf(\"Array sebelum delete: \");\n    for(int i=0; i\u003cn; i++) {\n        printf(\"%d \", arr[i]);\n    }\n\n    deleteLast(arr, n);\n\n    printf(\"\\nArray setelah delete: \");\n    for(int i=0; i\u003cn; i++) {\n        printf(\"%d \", arr[i]);\n    }\n\n    return 0;\n}\n```\n\n\u003chr\u003e\u003cbr\u003e\n\n## Features\n\n- Simple and easy-to-understand examples\n- Efficient list manipulation techniques\n- Suitable for beginners and intermediate programmers\n\n\u003chr\u003e\u003cbr\u003e\n\n## Technologies Used\n\n- Python\n- C++\n  \n\u003chr\u003e\u003cbr\u003e\n\n## Project Setup\n\n1. **Clone the repository:**\n   ```bash\n   git clone https://github.com/guanshiyin28/Delete-First-and-Delete-Last-Function.git\n   ```\n2. **Navigate to the project directory:**\n   ```bash\n   cd Delete-First-and-Delete-Last-Function\n   ```\n\n\u003chr\u003e\u003cbr\u003e\n\n## Steps to Run\n\n### Python\n\n1. **Run the Python script:**\n   ```bash\n   python program.py\n   ```\n\n### C++\n\n1. **Compile the C++ program:**\n   ```bash\n   g++ program.cpp -o program\n   ```\n2. **Run the compiled program:**\n   ```bash\n   ./Delete First\n   ```\n   ```bash\n   ./Delete Last\n   ```\n   \n\u003chr\u003e\u003cbr\u003e\n\n## License\n\nThis project is licensed under the Apache-2.0 License. See the [LICENSE](LICENSE) file for details.\n\n\u003chr\u003e\u003cbr\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://www.instagram.com/guanshiyin_/\"\u003e\n  \u003cimg src=\"https://capsule-render.vercel.app/api?type=waving\u0026height=200\u0026color=100:393E46,20:F7F7F7\u0026section=footer\u0026reversal=false\u0026textBg=false\u0026fontAlignY=50\u0026descAlign=48\u0026descAlignY=59\"/\u003e\n\u003c/a\u003e\n\u003c/div\u003e\n","funding_links":["https://github.com/sponsors/guanshiyin28"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaxastd%2FDelete-First-and-Last","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaxastd%2FDelete-First-and-Last","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaxastd%2FDelete-First-and-Last/lists"}