{"id":19562073,"url":"https://github.com/t-eckert/stack_max","last_synced_at":"2025-06-11T12:11:13.582Z","repository":{"id":131206469,"uuid":"200454387","full_name":"t-eckert/stack_max","owner":"t-eckert","description":"Learning project. `StackMax` is a stack of integers that returns the largest integer in O(1) time.","archived":false,"fork":false,"pushed_at":"2019-08-05T01:34:22.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-04T02:55:22.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/t-eckert.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":"2019-08-04T05:37:02.000Z","updated_at":"2019-08-05T01:34:23.000Z","dependencies_parsed_at":"2023-04-29T16:57:48.878Z","dependency_job_id":null,"html_url":"https://github.com/t-eckert/stack_max","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-eckert%2Fstack_max","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-eckert%2Fstack_max/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-eckert%2Fstack_max/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-eckert%2Fstack_max/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/t-eckert","download_url":"https://codeload.github.com/t-eckert/stack_max/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-eckert%2Fstack_max/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259262644,"owners_count":22830561,"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":[],"created_at":"2024-11-11T05:13:21.128Z","updated_at":"2025-06-11T12:11:13.566Z","avatar_url":"https://github.com/t-eckert.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StackMax\n\nA learning project in Rust. An instance of `StackMax` works as a stack normally does, giving a user access to `push()`, `peek()`, and `pop()` functions. This stack additionally has the ability to return the maximum value in the stack.\n\nThis is accomplished by using two `Vec\u003ci32\u003e` to handle state inside of `StackMax`. One of these `Vec\u003ci32\u003e`, called `numbers`, is a stack of all numbers pushed onto `StackMax`. The other, called `maximums` (though should it be `maxima`?), is a stack of only the maximum numbers pushed to the `numbers` stack.\n\nWhen a number is pushed to `StackMax`, it is added to the `numbers` stack then compared to the number at the top of the `maximums` stack. If the number being pushed is greater than the value at the top of the `maximums` stack or if the stack is empty, the number is pushed to the `maximums` stack.\n\nWhen a number is popped from `StackMax`, it is removed from the `numbers` stack and compared to the number at the top of the `maximums` stack. If they are equal, the number at the top of the `maximums` stack is also removed.\n\n## Demo\n\nThe StackMax object is initialized.\n\n``` text\nStackMax {\n    numbers: \n    maximums:\n}\n```\n\n4 is pushed to StackMax.\n\n``` text\nStackMax {\n    numbers: 4\n    maximums: 4\n}\n```\n\n2 is pushed to StackMax.\n\n``` text\nStackMax {\n    numbers: 4, 2\n    maximums: 4\n}\n```\n\n6 is pushed to StackMax.\n\n``` text\nStackMax {\n    numbers: 4, 2, 6\n    maximums: 4, 6\n}\n```\n\n6 is popped from StackMax.\n\n``` text\nStackMax {\n    numbers: 4, 2\n    maximums: 4\n}\n```\n\n2 is popped from StackMax.\n\n``` text\nStackMax {\n    numbers: 4\n    maximums: 4\n}\n```\n\n4 is popped from StackMax.\n\n``` text\nStackMax {\n    numbers: \n    maximums:\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft-eckert%2Fstack_max","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ft-eckert%2Fstack_max","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft-eckert%2Fstack_max/lists"}