nisbweb / Code-Alchemy

Repository for Hacktoberfest 2024
2 stars 33 forks source link

Create Stack_using_Array.cpp #54

Closed shubhamjain1402 closed 1 month ago

shubhamjain1402 commented 1 month ago

This code shows the implementation of stack data structure using array.

[Issue #53 ]

Haripriya-1212 commented 1 month ago

You have not considered stack overflow and underflow conditions while implementing functions. You can correct and make a pull request.

shubhamjain1402 commented 1 month ago

@Haripriya-1212. Thanks for pointing out the mistake.

Updated the corrected code. Issue [#60]

Haripriya-1212 commented 1 month ago

Hi! Your insertion sort is correct, but in stack code you have made one mistake. Line 16 - if (top >= size - 1) { This makes it not possible to add last element to the satck as it gives overflow warning 1 step before.

You can correct you code and make a PR.

shubhamjain1402 commented 1 month ago

Hey! @Haripriya-1212 Again, thanks for correction.

Updated the code. [Issue #60]

PS: - Can u please review the code under hacktoberfest.

Haripriya-1212 commented 1 month ago

Yeah sure