fave77 / Mathball

A JavaScript library for Competitive Programming
https://fave77.github.io/Mathball-Docs/
MIT License
99 stars 49 forks source link

Sort a matrix row-wise / column-wise #152

Closed sakshichahal53 closed 5 years ago

sakshichahal53 commented 5 years ago

Do the checklist before filing the issue:

NOTE: Provide a clear and concise description of the feature that needs to be added! Or if its a bug, then provide the necessary steps to reproduce it along with screenshots.

Given a matrix, use sort function to sort it row-wise/column-wise as desired in the most optimal time and space complexity.

sakshichahal53 commented 5 years ago

Hi @pbiswas101 , I'd like to work on this issue.

chichra commented 5 years ago

This sorting based on rows and columns, is needed a lot when working with large data. I would also like to contribute @pbiswas101

fave77 commented 5 years ago

@sakshichahal53 you're assigned!

if 'a' is a matrix, then implement it like so:

a.sort('row')
b.sort('column')
fave77 commented 5 years ago

@chichra this issue is already assigned to @sakshichahal53 who claimed it first

sakshichahal53 commented 5 years ago

@pbiswas101, how do we use it with a mathball object? Sorting of an array is written as : M.sort(a,false); Could we add two more arguments? (a) an int for the dimension (b) a character for row/column-wise sorting ['r','c']

fave77 commented 5 years ago

if 'a' is a matrix, then implement it like so:

a.sort('row')
b.sort('column')

@sakshichahal53 include the sort method in the Matrix constructor, which will be different from M.sort()

sakshichahal53 commented 5 years ago

package-lock.json file has been automatically updated due to the installation of node modules for "npm run test". The final files in the upstream and origin are same when compared. I have not made any changes to the package-lock.json file.

fave77 commented 5 years ago

@sakshichahal53 still your PR is including changes to files that have been made in the previous PRs.