EvgenyKarkan/EKAlgorithms

To move most of the methods in appropriate categories

vittoriom opened this issue · 5 comments

After taking a look at the classes, I found that most of the methods could be simplified if moved to categories instead of their own class.

Example:
+ (NSUInteger)indexOfMaximumElementInArray:(NSArray *)array;
could become
- (NSUInteger)indexOfMaximumElement;

+ (NSInteger)indexOfObjectViaLinearSearch:(id)object inArray:(NSArray *)arrayToSearch;
could become
- (NSInteger)indexOfObjectViaLinearSearch:(id)object;

+ (NSMutableArray *)bubbleSortedArrayWithUnsortedArray:(NSMutableArray *)unsortedArray;
could become
- (NSArray *)bubbleSort;

+ (BOOL)isGivenStringPalindrome:(NSString *)string;
could become
- (BOOL)isPalindrome;

and so on..
Do you agree with this? If yes, I will move methods to categories so that their interface will be easier to use.

Vittorio, I agree.

Just a tiny questions:

  • If I understand you correctly - you're talking about next 3 categories - NSArray, NSString & NSNumber classes?
  • Are you going to keep the current README file structure? - if not, then plz provide your ideas - how to restructure the README file.

Thnx!

PS
Hi Stanislaw :)

+1

@EvgenyKarkan
Yes, I'm talking about categories for NSArray, NSString and NSNumber
I think the README can stay the same, except probably the fact that sort and search algorithms will go into the NSArray category, but I don't see a problem in this.

OK.
Merged your previous PR.