Skip to content

Conversation

@rawheel
Copy link

@rawheel rawheel commented Oct 11, 2022

Describe your change:

A dynamic array, growable array, resizable array, dynamic table, mutable array, or array list is a random access, variable-size list data structure that allows elements to be added or removed. Dynamic arrays overcome a limit of static arrays, which have a fixed capacity that needs to be specified at allocation.

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • [x ] All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.
A dynamic array, growable array, resizable array, dynamic table, mutable array, or array list is a random access, variable-size list data structure that allows elements to be added or removed. Dynamic arrays overcome a limit of static arrays, which have a fixed capacity that needs to be specified at allocation.
@algorithms-keeper algorithms-keeper bot added require tests Tests [doctest/unittest/pytest] are required require type hints https://docs.python.org/3/library/typing.html labels Oct 11, 2022
Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

@@ -0,0 +1,196 @@
class resizable_array:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class names should follow the CamelCase naming convention. Please update the following name accordingly: resizable_array

@@ -0,0 +1,196 @@
class resizable_array:
def __init__(self,arraysize):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide return type hint for the function: __init__. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: arraysize

self.arraysize = arraysize
self.array = [None for i in range(self.arraysize)]
self.temp =1
def __insert(self,value):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function __insert

Please provide return type hint for the function: __insert. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: value

#print(self.array)
#return self.array

def insert_at_end(self, value):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function insert_at_end

Please provide return type hint for the function: insert_at_end. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: value

#return self.array
else:
self.__insert(value)
def printarray(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function printarray

Please provide return type hint for the function: printarray. If the function does not return a value, please provide the type hint as: def function() -> None:

else:
print("value does not exists in Array after which you want to insert new value!")

def shrink(self,value):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function shrink

Please provide return type hint for the function: shrink. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: value

self.newarray=None
#print(self.array)
#return self.array
def maximum_value(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function maximum_value

Please provide return type hint for the function: maximum_value. If the function does not return a value, please provide the type hint as: def function() -> None:

for j in range(len(self.array)):
if max<self.array[j]:
max = self.array[j]
print("maximum value in array is: {}".format( max))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the Contributing Guidelines, please do not use printf style formatting or str.format(). Use f-string instead to be more readable and efficient.

max = self.array[j]
print("maximum value in array is: {}".format( max))
return max
def minimum_value(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function minimum_value

Please provide return type hint for the function: minimum_value. If the function does not return a value, please provide the type hint as: def function() -> None:

for j in range(len(self.array)):
if min>self.array[j]:
min = self.array[j]
print("minimum value in array is: {}".format(min))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the Contributing Guidelines, please do not use printf style formatting or str.format(). Use f-string instead to be more readable and efficient.

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Oct 11, 2022
Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

@@ -0,0 +1,202 @@
class resizable_array:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class names should follow the CamelCase naming convention. Please update the following name accordingly: resizable_array

@@ -0,0 +1,202 @@
class resizable_array:
def __init__(self, arraysize):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide return type hint for the function: __init__. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: arraysize

self.array = [None for i in range(self.arraysize)]
self.temp = 1

def __insert(self, value):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function __insert

Please provide return type hint for the function: __insert. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: value

# print(self.array)
# return self.array

def insert_at_end(self, value):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function insert_at_end

Please provide return type hint for the function: insert_at_end. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: value

else:
self.__insert(value)

def printarray(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function printarray

Please provide return type hint for the function: printarray. If the function does not return a value, please provide the type hint as: def function() -> None:

# print(self.array)
# return(self.array)

def delete_at_first(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function delete_at_first

Please provide return type hint for the function: delete_at_first. If the function does not return a value, please provide the type hint as: def function() -> None:

# print(self.array)
# return self.array

def insert_at_middle(self, insertafter, insertedvalue):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function insert_at_middle

Please provide return type hint for the function: insert_at_middle. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: insertafter

Please provide type hint for the parameter: insertedvalue

"value does not exists in Array after which you want to insert new value!"
)

def shrink(self, value):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function shrink

Please provide return type hint for the function: shrink. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: value

# print(self.array)
# return self.array

def maximum_value(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function maximum_value

Please provide return type hint for the function: maximum_value. If the function does not return a value, please provide the type hint as: def function() -> None:

print(f"maximum value in array is: {max}")
return max

def minimum_value(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/Resizable_Array.py, please provide doctest for the function minimum_value

Please provide return type hint for the function: minimum_value. If the function does not return a value, please provide the type hint as: def function() -> None:

@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Oct 11, 2022
@cclauss
Copy link
Member

cclauss commented Oct 12, 2022

Please read our CONTRIBUTING.md document before submitting another pull request to this repo.

@cclauss cclauss closed this Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed require tests Tests [doctest/unittest/pytest] are required require type hints https://docs.python.org/3/library/typing.html tests are failing Do not merge until tests pass

2 participants